lkml.org 
[lkml]   [2021]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@linux.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

\
 
 \ /
  Last update: 2021-05-04 09:43    [W:0.081 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site