[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YJ+60n/xPCqH4BcI@kroah.com>
Date: Sat, 15 May 2021 14:13:06 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Zhihao Cheng <chengzhihao1@...wei.com>
Cc: mathias.nyman@...el.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
yukuai3@...wei.com
Subject: Re: [PATCH v2] usb: xhci: Check the return value from
sg_pcopy_from_buffer
On Sat, May 15, 2021 at 07:57:15PM +0800, Zhihao Cheng wrote:
> Fix the following gcc warning:
>
> drivers/usb/host/xhci.c:1349:15: warning: variable ‘len’ set but not
> used [-Wunused-but-set-variable ]
>
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Zhihao Cheng <chengzhihao1@...wei.com>
> ---
> drivers/usb/host/xhci.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index ca9385d22f68..08290698b939 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1361,11 +1361,15 @@ static void xhci_unmap_temp_buf(struct usb_hcd *hcd, struct urb *urb)
> urb->transfer_buffer_length,
> dir);
>
> - if (usb_urb_dir_in(urb))
> + if (usb_urb_dir_in(urb)) {
> len = sg_pcopy_from_buffer(urb->sg, urb->num_sgs,
> urb->transfer_buffer,
> buf_len,
> 0);
> + if (len != buf_len)
> + xhci_warn(hcd_to_xhci(hcd), "WARN Wrong transfer buffer read length: %u != %u\n",
> + len, buf_len);
So you complain to the user and then don't do anything else? that feels
very wrong, who is going to address the user complaints that this change
will cause?
greg k-h
Powered by blists - more mailing lists