Re: [kbuild-all] Re: [linux-stable-rc:linux-4.4.y 1449/1774] drivers/input/joydev.c:485:16: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int'

From: Rong Chen
Date: Mon Jul 19 2021 - 05:09:04 EST




On 7/19/21 3:17 PM, Dan Carpenter wrote:
On Mon, Jul 19, 2021 at 11:39:16AM +0800, kernel test robot wrote:
drivers/input/joydev.c: In function 'joydev_handle_JSIOCSAXMAP':
drivers/input/joydev.c:451:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
451 | for (i = 0; i < len && i < joydev->nabs; i++) {
We should figure out a way to turn this warning off in the compiler.

It's a stupid warning. It never fixes any bugs. It sometimes
introduces bugs.

In the kernel if you are in drivers/ and you have a loop which iterates
over 2 million times that's probably a bug. But GCC is very very
stupid and not designed to be a static analysis tool. It does not know
which loops can iterate more than 2 million times. Even when it knows
that the loop only loops up to 5 or 10 times it still warns that maybe
it will loop over 2 million times. INSULTS AND DISPARAGEMENT!

Seriously, please disable this warning unless you can point to one
single bug that it has fixed.

Hi Dan,

Thanks for the explanation, we'll stop reporting this warning.

Best Regards,
Rong Chen


regards,
dan carpenter