[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <169549523606.309442.12357071231764109578.b4-ty@kernel.org>
Date: Sat, 23 Sep 2023 21:54:16 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Yishai Hadas <yishaih@...dia.com>, Jason Gunthorpe <jgg@...pe.ca>,
Jack Morgenstein <jackm@....mellanox.co.il>,
Roland Dreier <roland@...estorage.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-rdma@...r.kernel.org
Subject: Re: [PATCH] IB/mlx4: Fix the size of a buffer in add_port_entries()
On Sat, 23 Sep 2023 07:55:56 +0200, Christophe JAILLET wrote:
> In order to be sure that 'buff' is never truncated, its size should be
> 12, not 11.
>
> When building with W=1, this fixes the following warnings:
>
> drivers/infiniband/hw/mlx4/sysfs.c: In function ‘add_port_entries’:
> drivers/infiniband/hw/mlx4/sysfs.c:268:34: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
> 268 | sprintf(buff, "%d", i);
> | ^
> drivers/infiniband/hw/mlx4/sysfs.c:268:17: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 11
> 268 | sprintf(buff, "%d", i);
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/sysfs.c:286:34: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
> 286 | sprintf(buff, "%d", i);
> | ^
> drivers/infiniband/hw/mlx4/sysfs.c:286:17: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 11
> 286 | sprintf(buff, "%d", i);
> | ^~~~~~~~~~~~~~~~~~~~~~
>
> [...]
Applied, thanks!
[1/1] IB/mlx4: Fix the size of a buffer in add_port_entries()
https://git.kernel.org/rdma/rdma/c/d7f393430a17c2
Best regards,
--
Leon Romanovsky <leon@...nel.org>
Powered by blists - more mailing lists