Message ID | 1fb6393fa2e0702fef995834c3c7db972bbc4d06.1719837715.git.leon@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [rdma-next,1/2] RDMA/qib: Fix truncation compilation warnings in qib_init.c | expand |
On 7/1/24 8:42 AM, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@nvidia.com> > > Reduce nodename string size to fit IB_DEVICE_NODE_DESC_MAX. > > drivers/infiniband/hw/qib/qib_verbs.c: In function ‘qib_register_ib_device’: > drivers/infiniband/hw/qib/qib_verbs.c:1554:40: error: ‘%s’ directive output may be truncated writing up to 64 bytes into a region of size 43 > [-Werror=format-truncation=] > 1554 | "Intel Infiniband HCA %s", init_utsname()->nodename); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/infiniband/hw/qib/qib_verbs.c:1553:9: note: ‘snprintf’ output between 22 and 86 bytes into a destination of size 64 > 1553 | snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1554 | "Intel Infiniband HCA %s", init_utsname()->nodename); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > cc1: all warnings being treated as errors > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com> > --- > drivers/infiniband/hw/qib/qib_verbs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c > index 0080f0be72fe..5fcb41970ad9 100644 > --- a/drivers/infiniband/hw/qib/qib_verbs.c > +++ b/drivers/infiniband/hw/qib/qib_verbs.c > @@ -1551,7 +1551,7 @@ int qib_register_ib_device(struct qib_devdata *dd) > ibdev->dev.parent = &dd->pcidev->dev; > > snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), > - "Intel Infiniband HCA %s", init_utsname()->nodename); > + "Intel Infiniband HCA %.42s", init_utsname()->nodename); > > /* > * Fill in rvt info object. Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c index 0080f0be72fe..5fcb41970ad9 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.c +++ b/drivers/infiniband/hw/qib/qib_verbs.c @@ -1551,7 +1551,7 @@ int qib_register_ib_device(struct qib_devdata *dd) ibdev->dev.parent = &dd->pcidev->dev; snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), - "Intel Infiniband HCA %s", init_utsname()->nodename); + "Intel Infiniband HCA %.42s", init_utsname()->nodename); /* * Fill in rvt info object.