Re: [PATCH v2] usb: xhci: Check the return value from sg_pcopy_from_buffer

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

 



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@xxxxxxxxxx>
> Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
> ---
>  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



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

  Powered by Linux