-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powerpc: drop port I/O helpers for CONFIG_HAS_IOPORT=n
Calling inb()/outb() on powerpc when CONFIG_PCI is disabled causes a NULL pointer dereference, which is bad for a number of reasons. After my patch to turn on -Werror in linux-next, this caused a compiler-time warning with clang: In file included from arch/powerpc/include/asm/io.h:672: arch/powerpc/include/asm/io-defs.h:43:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] 43 | DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | (p, b, c), pio, p) | ~~~~~~~~~~~~~~~~~~ In this configuration, CONFIG_HAS_IOPORT is already disabled, and all drivers that use inb()/outb() should now depend on that (some patches are still in the process of getting marged). Hide all references to inb()/outb() in the powerpc code and the definitions when HAS_IOPORT is disabled to remove the possible NULL pointer access. The same should happin in asm-generic in the near future, but for now the empty inb() macros are still defined to ensure the generic version does not get pulled in. Signed-off-by: Arnd Bergmann <[email protected]> Reported-by: Naresh Kamboju <[email protected]> Closes: https://lore.kernel.org/all/CA+G9fYtEh8zmq8k8wE-8RZwW-Qr927RLTn+KqGnq1F=ptaaNsA@mail.gmail.com Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
- Loading branch information
Showing
5 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters