Re: [patch 1/2] ALSA: oxfw: some signedness bugs

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

 



On Dec 13 2014 16:04, Dan Carpenter wrote:
> On Sat, Dec 13, 2014 at 02:06:59PM +0900, Takashi Sakamoto wrote:
>> On Dec 13 2014 04:27, Dan Carpenter wrote:
>>> This code tends to use unsigned variables by default and it causes
>>> signedness bugs when we use negative variables for error handling.
>>> The "i" and "j" variables are used to iterated over small positive
>>> values and so they should be type "int".  The "len" variable doesn't
>>> *need* to be signed but it should be signed to make the code easier to
>>> read and audit.
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>>
>> Thanks, but I prefer to use 'unsigned int' for loop counter, like the
>> other drivers.
> 
> Unthinking use of unsigned int every where is a kind of leprosy.  It
> just makes the code hard to read and it causes bugs.

In the beginning of last year, I received a comment from Clemens to use
'unsigned int' type for loop counter instead of 'int' type. Since then,
for ALSA firewire stack, I've been following his advice. (but actually I
missed to OXFW driver...)

For consistency inner this stack, I request you to follow this.


Regards

Takashi Sakamoto
o-takashi@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux