Re: [PATCH v5 3/3] asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE
From: Arnd Bergmann <arnd@arndb.de>
Date: 2021-05-10 13:51:22
Also in:
linux-arch, linux-s390, lkml, oe-kbuild-all
On Mon, May 10, 2021 at 3:08 PM kernel test robot [off-list ref] wrote:
In file included from include/linux/kernel.h:10, from drivers/media/rc/nuvoton-cir.c:25: include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/page.h:89:50: warning: ordered comparison of pointer with null pointer [-Wextra] 89 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ^~ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON' 137 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~ include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid' 137 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~~~~~~~~~~ drivers/media/rc/nuvoton-cir.c: In function 'nvt_get_rx_ir_data':quoted
quoted
drivers/media/rc/nuvoton-cir.c:761:15: warning: iteration 32 invokes undefined behavior [-Waggressive-loop-optimizations]761 | nvt->buf[i] = nvt_cir_reg_read(nvt, CIR_SRXFIFO);
I think you can ignore this one, it's a preexisting issue with this
driver that gets uncovered by your patch: if "fifocount" is read from
a broken device as 0xff, the loop causes a buffer overflow.
The code is already unreachable because the interrupt handler
will have aborted already, so the compiler's dead code elimination
should have shut up that warning, but adding a range check
before the loop would address this as well.
As far as I can tell, this warning only shows up when building with
"make W=1".
Arnd