Skip to content

Commit 6770d1c

Browse files
pabigotcarlescufi
authored andcommitted
usb: dfu: correct upload implementation
The routine to read the image from the device and upload it to the host stored data in a buffer unrelated to the one transferred to the host, resulting in a corrupt image. Signed-off-by: Peter A. Bigot <[email protected]>
1 parent da963d9 commit 6770d1c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

subsys/usb/class/usb_dfu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ struct dfu_data_t {
290290
/* Number of bytes sent during upload */
291291
u32_t bytes_sent;
292292
u32_t alt_setting; /* DFU alternate setting */
293-
u8_t buffer[USB_DFU_MAX_XFER_SIZE]; /* DFU data buffer */
294293
struct flash_img_context ctx;
295294
enum dfu_state state; /* State of the DFU device */
296295
enum dfu_status status; /* Status of the DFU device */
@@ -521,7 +520,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
521520
break;
522521
}
523522
ret = flash_area_read(fa, dfu_data.bytes_sent,
524-
dfu_data.buffer, len);
523+
*data, len);
525524
flash_area_close(fa);
526525
if (ret) {
527526
dfu_data.state = dfuERROR;

0 commit comments

Comments
 (0)