summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2013-06-16 11:05:05 +0200
committerBertrik Sikken <bertrik@sikken.nl>2013-08-12 10:48:35 +0200
commitb662e3a2dcaf144471e0558681f4b78dac013f30 (patch)
tree7e4b84fd86e9257ee3742ae9cc5faaecc7b97a14 /firmware/usbstack
parentc01a728c5ab321c73e4ef18349199d54bbef7dbb (diff)
downloadrockbox-b662e3a2dcaf144471e0558681f4b78dac013f30.tar.gz
rockbox-b662e3a2dcaf144471e0558681f4b78dac013f30.zip
Fix response length calculation for SCSI_REPORT_LUNS
Change-Id: I1167851bae20d9275eb2f441ce9dc73c8b2f09b1 Reviewed-on: http://gerrit.rockbox.org/488 Reviewed-by: Frank Gevaerts <frank@gevaerts.be> Reviewed-by: Bertrik Sikken <bertrik@sikken.nl> Tested-by: Bertrik Sikken <bertrik@sikken.nl>
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_storage.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index c51b0faa4c..b898978776 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -816,7 +816,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
case SCSI_REPORT_LUNS: {
logf("scsi report luns %d",lun);
- int allocation_length=0;
+ unsigned int allocation_length=0;
int i;
unsigned int response_length = 8+8*storage_num_drives();
allocation_length|=(cbw->command_block[6]<<24);
@@ -834,6 +834,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
#endif
tb.lun_data->luns[i][1]=0;
}
+ length = MIN(length, allocation_length);
send_command_result(tb.lun_data,
MIN(response_length, length));
break;