Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1536832
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers |
| Date | 2016-12-06 11:30 +0100 |
| Message-ID | <sLlax-Oj-31@gated-at.bofh.it> (permalink) |
| References | <sKuIV-194-3@gated-at.bofh.it> <sKuIW-194-39@gated-at.bofh.it> <sL8wG-Xr-27@gated-at.bofh.it> <sLbEd-38a-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Dec 05, 2016 at 07:10:45PM -0500, Brian Masney wrote: > On Mon, Dec 05, 2016 at 11:53:39PM +0300, Dan Carpenter wrote: > > On Sat, Dec 03, 2016 at 09:19:36PM -0500, Brian Masney wrote: > > > Fixed warning found by make W=2 to reduce the amount of build noise: > > > > > > warning: comparison between signed and unsigned integer expressions > > > [-Wsign-compare] > > > > Ugh... Please don't do work arounds for nonsense warnings. W=2 is so > > stupid. Better to just grep -v this warning instead of trying to please > > a broken static analysis. Warnings like this are why it's disabled by > > default. > > Hi Dan, > I would normally agree, however there could be a case where this > warning flags a legitimate issue. It is obviously not an issue in this > case. Since I'm already working on cleaning up this driver to move it > out of staging, I figured that I would make sure that it builds cleanly > with W=2. This was the only warning found in that driver. The > change is harmless in my opinion and it may eliminate a nonsense warning > for someone else down the road when doing security audits. Iterators should be int unless there is a specific reason for a fancier data type. Using complicated types just makes the code more complicated and tiring to read. Smatch or other similar static analysis tools know that "sel" is in the 0-7 range and that ARRAY_SIZE(prox_period) is 8. GCC almost certainly knows this as well. The warning messages is just printed because the devs are lazy. It's totally pointless. Don't work around lazy static analysis. It sends the wrong message to do pointless things. regards, dan carpenter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/19] staging: iio: isl29028: staging cleanups Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 03/19] staging: iio: isl29028: remove chip test and defaults from isl29028_chip_init() Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 15/19] staging: iio: isl29028: made error messages consistent Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 19/19] staging: iio: isl29028: remove legacy device tree binding Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 09/19] staging: iio: isl29028: change newlines to improve readability Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers Dan Carpenter <dan.carpenter@oracle.com> - 2016-12-05 22:00 +0100
Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers Brian Masney <masneyb@onstation.org> - 2016-12-06 01:20 +0100
Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers Dan Carpenter <dan.carpenter@oracle.com> - 2016-12-06 11:30 +0100
[PATCH 10/19] staging: iio: isl29028: remove unused define ISL29028_DEV_ATTR Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 04/19] staging: iio: isl29028: add power management support Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
[PATCH 16/19] staging: iio: isl29028: remove unnecessary error logging in isl29028_chip_init_and_power_on() Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
csiph-web