linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	linux-rdma@vger.kernel.org
Cc: Leon Romanovsky <leonro@nvidia.com>,
	kernel test robot <lkp@intel.com>,
	Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
	llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IB/qib: Fix null pointer subtraction compiler warning
Date: Wed, 8 Sep 2021 08:44:20 -0300	[thread overview]
Message-ID: <20210908114420.GA3190597@nvidia.com> (raw)
In-Reply-To: <0-v1-43ae3c759177+65-qib_type_jgg@nvidia.com>

On Fri, Sep 03, 2021 at 10:07:28AM -0300, Jason Gunthorpe wrote:
> >> drivers/infiniband/hw/qib/qib_sysfs.c:411:1: warning: performing pointer subtraction with a null pointer has undefined behavior
> +[-Wnull-pointer-subtraction]
>    QIB_DIAGC_ATTR(rc_resends);
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/infiniband/hw/qib/qib_sysfs.c:408:51: note: expanded from macro 'QIB_DIAGC_ATTR'
>                    .counter = &((struct qib_ibport *)0)->rvp.n_##N - (u64 *)0,    \
> 
> Use offsetof and accomplish the type check using static_assert.
> 
> Fixes: 4a7aaf88c89f ("RDMA/qib: Use attributes for the port sysfs")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
> ---
>  drivers/infiniband/hw/qib/qib_sysfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to for-rc

Jason

      parent reply	other threads:[~2021-09-08 11:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 13:07 [PATCH] IB/qib: Fix null pointer subtraction compiler warning Jason Gunthorpe
2021-09-03 17:24 ` Dennis Dalessandro
2021-09-08 11:44 ` Jason Gunthorpe [this message]

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=20210908114420.GA3190597@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=kbuild-all@lists.01.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mike.marciniszyn@cornelisnetworks.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).