Home
last modified time | relevance | path

Searched hist:"84 f969e1c48ed3825986e91a0786e363d57f69d1" (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/drivers/infiniband/hw/qib/
H A Dqib_sysfs.cdiff 84f969e1c48ed3825986e91a0786e363d57f69d1 Fri Sep 03 08:07:28 CDT 2021 Jason Gunthorpe <jgg@nvidia.com> IB/qib: Fix null pointer subtraction compiler warning

>> 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")
Link: https://lore.kernel.org/r/0-v1-43ae3c759177+65-qib_type_jgg@nvidia.com
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>