Re: [PATCH] usb/config: use proper endian access for wMaxPacketSize

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

 



Hi Sebastian,

On 25/07/11 20:12, Sebastian Andrzej Siewior wrote:
> wMaxPacketSize is __le16 and should be accessed as such.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> Just stumpled over this one while browsing through cide. Is this already
> been fixed by Matt?

Good find, actually I hadn't seen that.  About 10 lines down there's a bad use
of wBytesPerInterval (which is now correctly typed thanks to your April patch)
but not written as LE:

  CHECK   /home/matt/external-proj/usb-2.6/drivers/usb/core/config.c
...
usb/drivers/usb/core/config.c:140:36: warning: incorrect type in assignment (different base types)
usb/drivers/usb/core/config.c:140:36:    expected restricted __le16 [usertype] wBytesPerInterval
usb/drivers/usb/core/config.c:140:36:    got int [signed] [assigned] max_tx

Would you mind please fixing this while you're down there?

Sparse is good, I like it. :)

Cheers,


Matt


> 
>  drivers/usb/core/config.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> index c962608..e940030 100644
> --- a/drivers/usb/core/config.c
> +++ b/drivers/usb/core/config.c
> @@ -123,10 +123,11 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno,
>  	}
>  
>  	if (usb_endpoint_xfer_isoc(&ep->desc))
> -		max_tx = ep->desc.wMaxPacketSize * (desc->bMaxBurst + 1) *
> -			(desc->bmAttributes + 1);
> +		max_tx = (desc->bMaxBurst + 1) * (desc->bmAttributes + 1) *
> +			le16_to_cpu(ep->desc.wMaxPacketSize);
>  	else if (usb_endpoint_xfer_int(&ep->desc))
> -		max_tx = ep->desc.wMaxPacketSize * (desc->bMaxBurst + 1);
> +		max_tx = le16_to_cpu(ep->desc.wMaxPacketSize) *
> +			(desc->bMaxBurst + 1);
>  	else
>  		max_tx = 999999;
>  	if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) {

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