[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a1F1X2SUZLLxK8_QriRZjYyV2AYJFNQt=sGZcWP8yovaw@mail.gmail.com>
Date: Tue, 4 May 2021 09:42:42 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Niklas Schnelle <schnelle@...ux.ibm.com>
Cc: Vineet Gupta <vgupta@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
clang-built-linux <clang-built-linux@...glegroups.com>,
linux-arch <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-s390 <linux-s390@...r.kernel.org>,
"open list:SYNOPSYS ARC ARCHITECTURE"
<linux-snps-arc@...ts.infradead.org>,
sparclinux <sparclinux@...r.kernel.org>
Subject: Re: [PATCH v4 0/3] asm-generic/io.h: Silence -Wnull-pointer-arithmetic
warning on PCI_IOBASE
On Tue, May 4, 2021 at 9:40 AM Niklas Schnelle <schnelle@...ux.ibm.com> wrote:
> On Mon, 2021-05-03 at 18:07 +0200, Arnd Bergmann wrote:
> > - for the risc-v patch, I would suggest explaining that this fixes
> > an existing runtime bug, not just a compiler error:
> > | This is already broken, as accessing a fixed I/O port number of
> > | an ISA device on NOMMU RISC-V would turn into a NULL pointer
> > | dereference.
> > Feel free to either copy this, or use your own explanation.
>
> I mixed the above in with the current commit message:
>
> Without MMU support PCI_IOBASE is left undefined because PCI_IO_END is
> VMEMMAP_START. Nevertheless the in*()/out*() helper macros are left
> defined with uses of PCI_IOBASE. At the moment this only compiles
> because asm-generic/io.h defines PCI_IOBASE as 0 if it is undefined and
> so at macro expansion PCI_IOBASE is defined. This leads to compilation
> errors when asm-generic/io.h is changed to leave PCI_IOBASE undefined.
> More importantly it is currently broken at runtime, as accessing a fixed
> I/O port number of an ISA device on NOMMU RISC-V would turn into a NULL
> pointer dereference. Instead only define the in*()/out*() helper macros
> with MMU support and fall back to the asm-generic/io.h helper stubs
> otherwise.
Looks good, thanks. Maybe split into two or three paragraphs for readability.
Arnd
Powered by blists - more mailing lists