Re: [RFC 02/21] xhci: fix incorrect type in assignment in xhci_count_num_dropped_endpoints()

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

 



Applied to for-usb-next for 3.14.

Thanks,
Sarah Sharp

On Mon, Sep 09, 2013 at 09:03:07PM +0300, Xenia Ragiadakou wrote:
> The fields 'add_flags' and 'drop_flags' in struct xhci_input_control_ctx
> have type __le32 and need to be converted to CPU byteorder before being
> used to derive the number of dropped endpoints.
> This bug was found using sparse.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
> ---
>  drivers/usb/host/xhci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 617d568..bda0cdf 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1897,8 +1897,8 @@ static unsigned int xhci_count_num_dropped_endpoints(struct xhci_hcd *xhci,
>  	u32 valid_add_flags;
>  	u32 valid_drop_flags;
>  
> -	valid_add_flags = ctrl_ctx->add_flags >> 2;
> -	valid_drop_flags = ctrl_ctx->drop_flags >> 2;
> +	valid_add_flags = le32_to_cpu(ctrl_ctx->add_flags) >> 2;
> +	valid_drop_flags = le32_to_cpu(ctrl_ctx->drop_flags) >> 2;
>  
>  	return hweight32(valid_drop_flags) -
>  		hweight32(valid_add_flags & valid_drop_flags);
> -- 
> 1.8.3.4
> 
> --
> 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
--
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