All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: fix length check in xhci_align_td
@ 2019-07-04 18:33 Lorenzo Bianconi
  2019-07-06 20:24 ` Henry Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2019-07-04 18:33 UTC (permalink / raw)
  To: linux-usb; +Cc: henryl, gregkh, mathias.nyman, lorenzo.bianconi, nbd, sgruszka

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(-)

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);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: xhci: fix length check in xhci_align_td
  2019-07-04 18:33 [PATCH] usb: xhci: fix length check in xhci_align_td Lorenzo Bianconi
@ 2019-07-06 20:24 ` Henry Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Henry Lin @ 2019-07-06 20:24 UTC (permalink / raw)
  To: linux-usb

Similar change is posted in https://marc.info/?l=linux-usb&m=156152916509643&w=2
________________________________________
From: Lorenzo Bianconi <lorenzo@kernel.org>
Sent: Friday, July 5, 2019 2:33 AM
To: linux-usb@vger.kernel.org
Cc: Henry Lin; gregkh@linuxfoundation.org; mathias.nyman@linux.intel.com; lorenzo.bianconi@redhat.com; nbd@nbd.name; sgruszka@redhat.com
Subject: [PATCH] usb: xhci: fix length check in xhci_align_td

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(-)

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);
--
2.21.0

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-06 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 18:33 [PATCH] usb: xhci: fix length check in xhci_align_td Lorenzo Bianconi
2019-07-06 20:24 ` Henry Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.