On Thursday, January 03, 2013 5:02 AM, Dan Carpenter wrote:
> On Wed, Jan 02, 2013 at 01:12:15PM -0600, H Hartley Sweeten wrote:
>> On Wednesday, January 02, 2013 12:03 PM, Ian Abbott wrote:
>>> On 02/01/2013 18:10, H Hartley Sweeten wrote:
>>>> Will the munge_count always be larger, or equal, to the 
>>>> buf_read_alloc_count?
>>>> The original code had the (int) cast so I wasn't sure. If so, then yes the 
>>>> variable
>>>> should be an unsigned int.
>>>
>>> Well the value it is being compared to (nbytes) is an unsigned int, so 
>>> the int value (available) will be converted to unsigned int before the 
>>> comparison anyway.  So making 'available' an unsigned int to begin with 
>>> shouldn't break anything that isn't already broke!
>> 
>> Not so. Simple test:
>> 
>
> Uh...  Ian is correct.  In the new code it doesn't matter if
> "available" is signed or unsigned because the comparison is always
> promoted to unsigned.

Ah.. you are correct.

Hmmm.. Is the current code actually correct? I need to take a closer
look at it.

Regards,
Hartley

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to