diff mbox series

[rdma-next] RDMA/mlx4: Fix truncated output warning in alias_GUID.c

Message ID 1951c9500109ca7e36dcd523f8a5f2d0d2a608d1.1718554641.git.leon@kernel.org (mailing list archive)
State Accepted
Headers show
Series [rdma-next] RDMA/mlx4: Fix truncated output warning in alias_GUID.c | expand

Commit Message

Leon Romanovsky June 16, 2024, 4:17 p.m. UTC
From: Leon Romanovsky <leonro@nvidia.com>

drivers/infiniband/hw/mlx4/alias_GUID.c: In function ‘mlx4_ib_init_alias_guid_service’:
drivers/infiniband/hw/mlx4/alias_GUID.c:878:74: error: ‘%d’ directive
output may be truncated writing between 1 and 11 bytes into a region of
size 5 [-Werror=format-truncation=]
  878 |                 snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
      |                                                                          ^~
drivers/infiniband/hw/mlx4/alias_GUID.c:878:63: note: directive argument in the range [-2147483641, 2147483646]
  878 |                 snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
      |                                                               ^~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/alias_GUID.c:878:17: note: ‘snprintf’ output
between 12 and 22 bytes into a destination of size 15
  878 |                 snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Fixes: a0c64a17aba8 ("mlx4: Add alias_guid mechanism")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky June 24, 2024, 9:51 a.m. UTC | #1
On Sun, 16 Jun 2024 19:17:30 +0300, Leon Romanovsky wrote:
> drivers/infiniband/hw/mlx4/alias_GUID.c: In function ‘mlx4_ib_init_alias_guid_service’:
> drivers/infiniband/hw/mlx4/alias_GUID.c:878:74: error: ‘%d’ directive
> output may be truncated writing between 1 and 11 bytes into a region of
> size 5 [-Werror=format-truncation=]
>   878 |                 snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
>       |                                                                          ^~
> drivers/infiniband/hw/mlx4/alias_GUID.c:878:63: note: directive argument in the range [-2147483641, 2147483646]
>   878 |                 snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
>       |                                                               ^~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/alias_GUID.c:878:17: note: ‘snprintf’ output
> between 12 and 22 bytes into a destination of size 15
>   878 |                 snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> [...]

Applied, thanks!

[1/1] RDMA/mlx4: Fix truncated output warning in alias_GUID.c
      https://git.kernel.org/rdma/rdma/c/bc80b39bffebae

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c
index 111fa88a3be4..9a439569ffcf 100644
--- a/drivers/infiniband/hw/mlx4/alias_GUID.c
+++ b/drivers/infiniband/hw/mlx4/alias_GUID.c
@@ -829,7 +829,7 @@  void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
 
 int mlx4_ib_init_alias_guid_service(struct mlx4_ib_dev *dev)
 {
-	char alias_wq_name[15];
+	char alias_wq_name[22];
 	int ret = 0;
 	int i, j;
 	union ib_gid gid;