All of lore.kernel.org
 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-17 18:53 ` sashiko-bot
  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 related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-17 18:53 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-17 18:53 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.