usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data()
Subsystems (2)
PATCH v4 1/1 usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data()
From: Karina Yankevich <[email protected]>
In sddr55_{read|write}_data(), the address variables are needlessly typed as *unsigned long* -- which is 32-bit type on the 32-bit arches and 64-bit type on the 64-bit arches; those variables' value should fit into just 3 command bytes and consists of 10-bit block # (or at least the max block # seems to be 1023) and 4-/5-bit page # within a block, so 32-bit *unsigned* *int* type should be more than enough...
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
[Sergey: rewrote the patch subject/description]
---
This patch is against the 'usb-next' branch of Greg KH's usb.git repo...
Changes in version 4:
- added the correct From tag;
- added a note about my role;
- added Alan Stern's tag.
Changes in version 3:
- rewrote the patch subject/description.
Changes in version 2:
- compeltely redid the patch.
drivers/usb/storage/sddr55.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/storage/sddr55.c +2 -2
@@ -196,7 +196,7 @@ static int sddr55_read_data(struct us_daunsigned char *buffer;unsigned int pba; -unsigned long address; +unsigned int address;unsigned short pages;unsigned int len, offset;
@@ -316,7 +316,7 @@ static int sddr55_write_data(struct us_dunsigned int pba;unsigned int new_pba; -unsigned long address; +unsigned int address;unsigned short pages;int i;