[PATCH] USB: do not convert negative transfer_buffer_lengths to positive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



vi include/linux/usb.h +1373
struct urb {
	...
	int transfer_buffer_length;
	...
}
So I think something like this is needed?
------------------------------>8-------------8<---------------------------------
urb->transfer_buffer_length is signed, whereas data_len is not, take care not to
convert negative transfer_buffer_lengths to positive.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c
index bb63b68..46717f0 100644
--- a/drivers/usb/host/fhci-sched.c
+++ b/drivers/usb/host/fhci-sched.c
@@ -707,7 +707,7 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb)
 {
 	struct ed *ed = urb->ep->hcpriv;
 	struct urb_priv *urb_priv = urb->hcpriv;
-	u32 data_len = urb->transfer_buffer_length;
+	u32 data_len;
 	int urb_state = 0;
 	int toggle = 0;
 	struct td *td;
@@ -763,10 +763,13 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb)
 
 	urb_priv->tds_cnt = 0;
 	urb_priv->ed = ed;
-	if (data_len > 0)
+	if (urb->transfer_buffer_length > 0) {
 		data = urb->transfer_buffer;
-	else
+		data_len = urb->transfer_buffer_length;
+	} else if (urb->transfer_buffer_length == 0) {
 		data = NULL;
+		data_len = 0;
+	}
 
 	switch (ed->mode) {
 	case FHCI_TF_BULK:
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux