[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210908114420.GA3190597@nvidia.com>
Date: Wed, 8 Sep 2021 08:44:20 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
linux-rdma@...r.kernel.org
Cc: Leon Romanovsky <leonro@...dia.com>,
kernel test robot <lkp@...el.com>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/qib: Fix null pointer subtraction compiler warning
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@...el.com>
> Signed-off-by: Jason Gunthorpe <jgg@...dia.com>
> Acked-by: Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>
> ---
> drivers/infiniband/hw/qib/qib_sysfs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied to for-rc
Jason
Powered by blists - more mailing lists