Skip to content

Commit

Permalink
USB: storage: ene_ub6250: Use kmemdup instead of kmalloc + memcpy
Browse files Browse the repository at this point in the history
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Benoit Taine authored and Greg Kroah-Hartman committed May 27, 2014
1 parent a7683eb commit a328512
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/storage/ene_ub6250.c
Original file line number Diff line number Diff line change
Expand Up @@ -1928,11 +1928,10 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
usb_stor_dbg(us, "load firmware %s failed\n", fw_name);
goto nofw;
}
buf = kmalloc(sd_fw->size, GFP_KERNEL);
buf = kmemdup(sd_fw->data, sd_fw->size, GFP_KERNEL);
if (buf == NULL)
goto nofw;

memcpy(buf, sd_fw->data, sd_fw->size);
memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->DataTransferLength = sd_fw->size;
Expand Down

0 comments on commit a328512

Please sign in to comment.