linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Vineet Gupta <vgupta@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	"open list:SYNOPSYS ARC ARCHITECTURE" 
	<linux-snps-arc@lists.infradead.org>,
	sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCH v4 0/3] asm-generic/io.h: Silence -Wnull-pointer-arithmetic warning on PCI_IOBASE
Date: Tue, 04 May 2021 09:39:40 +0200	[thread overview]
Message-ID: <9e52895227515143bf3cd9197876ff1ed596682b.camel@linux.ibm.com> (raw)
In-Reply-To: <CAK8P3a3mCujxC0=_cL6Z88Xh2cb=OY_Ct7DVpJNvRn1v9=FhkQ@mail.gmail.com>

On Mon, 2021-05-03 at 18:07 +0200, Arnd Bergmann wrote:
> On Fri, Apr 30, 2021 at 1:16 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
> > From: Niklas Schnelle <niklas@komani.de>
> > 
> > This is version 4 of my attempt to get rid of a clang
> > -Wnull-pointer-arithmetic warning for the use of PCI_IOBASE in
> > asm-generic/io.h. This was originally found on s390 but should apply to
> > all platforms leaving PCI_IOBASE undefined while making use of the inb()
> > and friends helpers from asm-generic/io.h.
> > 
> > This applies cleanly and was compile tested on top of v5.12 for the
> > previously broken ARC, nds32, h8300 and risc-v architecture
> > 
> > I did boot test this only on x86_64 and s390x the former implements
> > inb() itself while the latter would emit a WARN_ONCE() but no drivers
> > use inb().
> 
> This looks all fine to me, but with the merge window open right now, I
> can't add it into linux-next yet, and it wouldn't qualify as a bugfix for 5.13.
> 
> Please resend them to me after -rc1 is out so I can merge it for
> 5.14 through the asm-generic tree.

Thanks for the great feedback I appreciate it. Will do the resend of
course.

> 
> Please add two small changes to the changelog texts:
> 
> - for patch 3, please include a 'Link: tag' to the lore archive of the
>   previous discussion, that should cover any questions that people
>   may have

Done

> 
> - 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.



> 
>        Arnd


  reply	other threads:[~2021-05-04  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 11:16 [PATCH v4 0/3] asm-generic/io.h: Silence -Wnull-pointer-arithmetic warning on PCI_IOBASE Niklas Schnelle
2021-04-30 11:16 ` [PATCH v4 1/3] sparc: explicitly set PCI_IOBASE to 0 Niklas Schnelle
2021-04-30 11:16 ` [PATCH v4 2/3] risc-v: Use generic io.h helpers for nommu Niklas Schnelle
2021-04-30 11:16 ` [PATCH v4 3/3] asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE Niklas Schnelle
2021-05-03 16:07 ` [PATCH v4 0/3] asm-generic/io.h: Silence -Wnull-pointer-arithmetic warning on PCI_IOBASE Arnd Bergmann
2021-05-04  7:39   ` Niklas Schnelle [this message]
2021-05-04  7:42     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e52895227515143bf3cd9197876ff1ed596682b.camel@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=vgupta@synopsys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).