Skip to contentSkip to conversation

usb: storage: realtek_cr: Use correct byte order for bcs->Residue

PATCH New Thorsten Blum 1 participant 1 message Aug 13, 2025

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

PATCH 1/1 usb: storage: realtek_cr: Use correct byte order for bcs->Residue

Since 'bcs->Residue' has the data type '__le32', convert it to the correct byte order of the CPU using this driver when assigning it to the local variable 'residue'.

Fixes 50a6cb932d5c ("USB: usb_storage: add ums-realtek driver")

---
Resending this as a separate patch for backporting as requested by Greg.
Link to previous patch: https://lore.kernel.org/lkml/[email protected]/

---
 drivers/usb/storage/realtek_cr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
index 8a4d7c0f2662..758258a569a6 100644
@@ -253,7 +253,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
 		return USB_STOR_TRANSPORT_ERROR;
 	}
 
-	residue = bcs->Residue;
+	residue = le32_to_cpu(bcs->Residue);
 	if (bcs->Tag != us->tag)
 		return USB_STOR_TRANSPORT_ERROR;
 
Signature · 1 line
2.50.1