From d6429a3555fb29f380c5841a12f5ac3f7444af03 Mon Sep 17 00:00:00 2001 From: Karina Yankevich Date: Sun, 21 Jan 2024 20:29:55 +0300 Subject: 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 Signed-off-by: Sergey Shtylyov Reviewed-by: Alan Stern Link: https://lore.kernel.org/r/4c9485f2-0bfc-591b-bfe7-2059289b554e@omp.ru Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/sddr55.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb/storage') 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; -- cgit v1.2.3 From ae28fd06b3a830aae34f1a3f3d7fbc2a5b59043a Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Wed, 7 Feb 2024 11:22:08 +0000 Subject: usb: storage: freecom: Remove redundant assignment to variable offset The variable offset is being assigned a value that is not being read afterwards, the assignment is redundant and can be removed. Cleans up clang scan warning: drivers/usb/storage/freecom.c:537:2: warning: Value stored to 'offset' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20240207112208.2443237-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/freecom.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/usb/storage') diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 2b098b55c4cb..c3ce51c2dabd 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c @@ -534,7 +534,6 @@ static void pdump(struct us_data *us, void *ibuffer, int length) } line[offset] = 0; usb_stor_dbg(us, "%s\n", line); - offset = 0; } #endif -- cgit v1.2.3