Skip to contentSkip to conversation

usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data()

PATCH In review Sergey Shtylyov 1 participant 2 messages Mar 21, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data()

When isd200_scsi_to_ata() emulates the SCSI READ CAPACITY command, the capacity local variable is needlessly typed as *unsigned long* -- which is 32-bit type on the 32-bit arches and 64-bit type on the 64-bit arches; this variable's value should always fit into 32 bits for both the ATA and the SCSI capacity data...

While at it, arrange the local variable declarations in the reverse Xmas tree order...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.

---
 drivers/usb/storage/isd200.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/isd200.c +1 -1
Index: usb/drivers/usb/storage/isd200.c
===================================================================
@@ -1283,8 +1283,8 @@ static int isd200_scsi_to_ata(struct scs
 
 	case READ_CAPACITY:
 	{
-		unsigned long capacity;
 		struct read_capacity_data readCapacityData;
+		u32 capacity;
 
 		usb_stor_dbg(us, "   ATA OUT - SCSIOP_READ_CAPACITY\n");
 
#1 lore raw

Hello!

Ignore this one, it was sent out with a wrong subject... :/

MBR, Sergey