[PATCH] RISC-V: io: Don't have a void* PCI_IOBASE
Andreas Schwab
schwab at suse.de
Mon May 27 00:44:13 PDT 2024
On Mai 26 2024, Palmer Dabbelt wrote:
> I recently started noticing warnings along the lines of
>
> include/asm-generic/io.h:752:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> insw(addr, buffer, count);
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> arch/riscv/include/asm/io.h:105:53: note: expanded from macro 'insw'
> #define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count)
>
> which are triggered by having PCI_IOBASE be a "void __iomem *". I'm not
> quite sure what the right thing to do is here: having it as u8 to make
> the pointer arithmetic work seems reasonable to me,
A u8 null pointer is still a null pointer. Are you sure you are quoting
the right warning? AFAICS, PCI_IOBASE is not a null pointer.
--
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the linux-riscv
mailing list