mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RDMA/usnic: Bound buffer size to sizeof(buf) in flowinfo_read()
@ 2026-10-17 18:50 Serhat Kumral
  2026-10-18 13:25 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Serhat Kumral @ 2026-10-17 18:50 UTC (permalink / raw)
  To: Nelson Escobar, Satish Kharat, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, Serhat Kumral

In flowinfo_read(), 'left' tracks the remaining space in the 512-byte
stack buffer 'buf', but it is initialized to 'count'.

Initialize 'left' to sizeof(buf) instead of 'count'.

Fixes: 9f637f793602 ("IB/usnic: Expose flows via debugfs")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
found by smatch:
- drivers/infiniband/hw/usnic/usnic_debugfs.c:85 flowinfo_read() error: scnprintf() 'ptr' too small (512 vs 1000000000)

 drivers/infiniband/hw/usnic/usnic_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_debugfs.c b/drivers/infiniband/hw/usnic/usnic_debugfs.c
index 10a8cd5ba076..ece7c6e71499 100644
--- a/drivers/infiniband/hw/usnic/usnic_debugfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_debugfs.c
@@ -76,7 +76,7 @@ static ssize_t flowinfo_read(struct file *f, char __user *data,
 
 	qp_flow = f->private_data;
 	ptr = buf;
-	left = count;
+	left = sizeof(buf);
 
 	if (*ppos > 0)
 		return 0;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA/usnic: Bound buffer size to sizeof(buf) in flowinfo_read()
  2026-10-17 18:50 [PATCH] RDMA/usnic: Bound buffer size to sizeof(buf) in flowinfo_read() Serhat Kumral
@ 2026-10-18 13:25 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-10-18 13:25 UTC (permalink / raw)
  To: Nelson Escobar, Satish Kharat, Jason Gunthorpe, Serhat Kumral
  Cc: linux-rdma, linux-kernel


On Sat, 17 Oct 2026 21:50:28 +0300, Serhat Kumral wrote:
> In flowinfo_read(), 'left' tracks the remaining space in the 512-byte
> stack buffer 'buf', but it is initialized to 'count'.
> 
> Initialize 'left' to sizeof(buf) instead of 'count'.

Applied, thanks!

[1/1] RDMA/usnic: Bound buffer size to sizeof(buf) in flowinfo_read()
      https://git.kernel.org/rdma/rdma/c/9dd8b9a337af84

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-18 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 18:50 [PATCH] RDMA/usnic: Bound buffer size to sizeof(buf) in flowinfo_read() Serhat Kumral
2026-10-18 13:25 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®