ChangeSet 1.1142, 2003/09/24 13:04:22-07:00, stern@rowland.harvard.edu

[PATCH] USB: Pad UFI commands to 12 bytes with zeros

This patch from Alan Stern zero-pads commands using the UFI protocol.  This
patch exists in 2.5, but never made it into 2.4

Not all devices require this padding, but some do.


 drivers/usb/storage/protocol.c |    4 ++++
 1 files changed, 4 insertions(+)


diff -Nru a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
--- a/drivers/usb/storage/protocol.c	Thu Sep 25 16:03:58 2003
+++ b/drivers/usb/storage/protocol.c	Thu Sep 25 16:03:58 2003
@@ -237,6 +237,10 @@
 	 * a unsigned char cmnd[12], so we know we have storage available
 	 */
 
+	/* Pad the ATAPI command with zeros */
+	for (; srb->cmd_len<12; srb->cmd_len++)
+		srb->cmnd[srb->cmd_len] = 0;
+
 	/* set command length to 12 bytes (this affects the transport layer) */
 	srb->cmd_len = 12;
 
