Content-Type: multipart/mixed; boundary="===============2633613057794800444==" MIME-Version: 1.0 From: Jason Gunthorpe To: kbuild-all@lists.01.org Subject: Re: [PATCH] IB/qib: Fix null pointer subtraction compiler warning Date: Wed, 08 Sep 2021 08:44:20 -0300 Message-ID: <20210908114420.GA3190597@nvidia.com> In-Reply-To: <0-v1-43ae3c759177+65-qib_type_jgg@nvidia.com> List-Id: --===============2633613057794800444== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Fri, Sep 03, 2021 at 10:07:28AM -0300, Jason Gunthorpe wrote: > >> drivers/infiniband/hw/qib/qib_sysfs.c:411:1: warning: performing point= er 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 macr= o 'QIB_DIAGC_ATTR' > .counter =3D &((struct qib_ibport *)0)->rvp.n_##N - (u= 64 *)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 > Signed-off-by: Jason Gunthorpe > Acked-by: Dennis Dalessandro > --- > drivers/infiniband/hw/qib/qib_sysfs.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Applied to for-rc Jason --===============2633613057794800444==--