Re: [PATCH] USB: more u32 conversion after transfer_buffer_length and actual_length

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

 



On Fri, 13 Mar 2009, Roel Kluin wrote:

> > In general, when declaring local variables like this, it's better to
> > make them just "unsigned".  There's no reason to specify that they have
> > 32 bits.  In fact, this would lead to inefficient code on a system with
> > 64-bit integers.
> 
> I did this for the local variables, but also for some of the function
> arguments and return values, which are compared with urb->actual_length and
> urb->transfer_buffer_length. Since both are less than INT_MAX, I think it is
> valid.

That's right.  Function parameters _are_ local variables.

> Again tested with checkpatch and compile tested without increase in sparse
> messages.
> ------------------------------>8-------------8<---------------------------------
> transfer_buffer_length and actual_length have become unsigned, therefore some
> additional conversion of local variables, function arguments and print
> specifications is desired. 
> 
> A test for a negative urb->transfer_buffer_length became obsolete; instead
> we ensure that it does not exceed INT_MAX. Also, urb->actual_length is always
> less than urb->transfer_buffer_length.
> 
> rh_string() does no longer return -EPIPE in the case of an unsupported ID.
> Instead its only caller, rh_call_control() does the check.
> 
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>

This looks good.

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Alan Stern

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