diff options
author | Karina Yankevich <k.yankevich@omp.ru> | 2024-01-21 18:29:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-28 01:44:00 +0100 |
commit | d6429a3555fb29f380c5841a12f5ac3f7444af03 (patch) | |
tree | 8032a319d6d49a245975c2563152cae6fec4b531 /drivers/usb/storage | |
parent | usb: usb_autopm_get_interface use modern helper (diff) | |
download | linux-d6429a3555fb29f380c5841a12f5ac3f7444af03.tar.xz linux-d6429a3555fb29f380c5841a12f5ac3f7444af03.zip |
usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data()
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]
Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/4c9485f2-0bfc-591b-bfe7-2059289b554e@omp.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/sddr55.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 15dc25801cdc..0aa079405d23 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c @@ -196,7 +196,7 @@ static int sddr55_read_data(struct us_data *us, unsigned 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_data *us, unsigned int pba; unsigned int new_pba; - unsigned long address; + unsigned int address; unsigned short pages; int i; |