Skip to contentSkip to conversation

Bug Report: 2cc7b6 exposes violations of type limits

DISCUSSION Yury Norov 1 participant 1 message May 13, 2021 1 message not in the archive

lore
Share & tools
lore

Yury Norov

author
#1 lore raw
In reply to a message not in the archive

[CC: LKML]

Quoted 49 lines · Max Görner

Dear Mr Norov, dear Mr Morton,

with this e-mail I want to report a bug in the kernel to you. I am approaching both of you because you are the author and the maintainer, respectively.

I am the maintainer of a community fork of a WIFI driver (rtl88x2bu,
https://github.com/cilynx/rtl88x2bu/tree/5.8.7.1_35809.20191129_COEX20191120-7777).
Usually new kernel versions introduce new incompatibilities which break the compilation. I then add a new #if LINUX_VERSION_CODE branch in which I fix things.

I am proud to say that the driver compiles with -O3 -Wall -Werror with only a modest number of -Wno-... directives. I usually compile with -O2 -Wall -Werror, though.

In the merge window for Linux Kernel v5.13 Mr Norov added commit 2cc7b6a44ac21d31b398b03f4845c53152070416 which looks fairly innocent to me. However, it exposes some information to GCC, allowing GCC to deduce that some comparisons do not make sense. Now GCC complains that there are tests whether an unsigned long is < 0.

However, these problems appear only when I try to compile the WIFI driver, not when compiling the kernel itself. I suspect that the problems would appear if the kernel would be compiled with -Wall -Werror, but I do not know how to do that. I attached the error messages in a separate file.

I think having type limit violations in the code is bad in itself. It also breaks some external code (my driver). With this bug report I want to kindly ask you if you could fix these type limit violations.

Thank you very much.

Best regards

Max Görner

make ARCH=x86_64 CROSS_COMPILE= -C /home/mgoerner/Werkbank/Hobbys/Linux-Kernel/linux M=/home/mgoerner/Werkbank/Hobbys/rtl88x2bu modules make[1]: Verzeichnis „/home/mgoerner/Werkbank/Hobbys/Linux-Kernel/linux“ wird betreten
CC [M] /home/mgoerner/Werkbank/Hobbys/rtl88x2bu/core/rtw_cmd.o
In file included from ./include/linux/bits.h:22,

                 from ./include/linux/bitops.h:6,
                 from ./include/linux/kernel.h:12,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:12,
                 from /home/mgoerner/Werkbank/Hobbys/rtl88x2bu/include/basic_types.h:76,
                 from /home/mgoerner/Werkbank/Hobbys/rtl88x2bu/include/drv_types.h:26,
                 from /home/mgoerner/Werkbank/Hobbys/rtl88x2bu/core/rtw_cmd.c:17:
Quoted 4 lines

./include/asm-generic/bitops/find.h: In function ‘find_first_bit’:
./include/linux/bits.h:25:28: error: comparison of unsigned expression in ‘< 0’ is always false [-Werror=type-limits]
25 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^

[...]

Kernel disables -Werror=type-limits in scripts/Makefile.extrawarn. It looks missed -Wno-type-limits in your scripts.