diff mbox series

usb: xhci: fix length check in xhci_align_td

Message ID 7c2f350f5a819f268d5f9f541784ccb073a35786.1562264858.git.lorenzo@kernel.org (mailing list archive)
State New, archived
Headers show
Series usb: xhci: fix length check in xhci_align_td | expand

Commit Message

Lorenzo Bianconi July 4, 2019, 6:33 p.m. UTC
Fix the following warning due to a wrong length check after
sg_pcopy_to_buffer in xhci_align_td

xhci_hcd 0000:00:04.0: WARN Wrong bounce buffer write length: 158 != 284
xhci_hcd 0000:00:04.0: WARN Wrong bounce buffer write length: 234 != 158
xhci_hcd 0000:00:04.0: WARN Wrong bounce buffer write length: 208 != 234
xhci_hcd 0000:00:04.0: WARN Wrong bounce buffer write length: 82 != 208

Fixes: 597c56e372da ("xhci: update bounce buffer with correct sg num")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/usb/host/xhci-ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Henry Lin July 6, 2019, 8:24 p.m. UTC | #1
Similar change is posted in https://marc.info/?l=linux-usb&m=156152916509643&w=2
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 121782e22c01..72fc6980c641 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3177,7 +3177,7 @@  static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len,
 	if (usb_urb_dir_out(urb)) {
 		len = sg_pcopy_to_buffer(urb->sg, urb->num_sgs,
 				   seg->bounce_buf, new_buff_len, enqd_len);
-		if (len != seg->bounce_len)
+		if (len != new_buff_len)
 			xhci_warn(xhci,
 				"WARN Wrong bounce buffer write length: %zu != %d\n",
 				len, seg->bounce_len);