All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: backend: fix uninitialized data in debugfs
@ 2026-05-25  7:16 Dan Carpenter
  2026-05-25 13:20 ` Maxwell Doose
  0 siblings, 1 reply; 15+ messages in thread
From: Dan Carpenter @ 2026-05-25  7:16 UTC (permalink / raw)
  To: Nuno Sa
  Cc: Olivier Moysan, Jonathan Cameron, David Lechner, Andy Shevchenko,
	linux-iio, linux-kernel, kernel-janitors

If the *ppos value is non-zero then simple_write_to_buffer() will not
initialize the start of the buf[] buffer.  Non-zero ppos values aren't
going to work at all.  Check for that at the start of the function and
return -EINVAL.

Fixes: cdf01e0809a4 ("iio: backend: add debugFs interface")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/iio/industrialio-backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index 138ebebc9c0d..4763e224ebc6 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -156,7 +156,7 @@ static ssize_t iio_backend_debugfs_write_reg(struct file *file,
 	ssize_t rc;
 	int ret;
 
-	if (count >= sizeof(buf))
+	if (*ppos != 0 || count >= sizeof(buf))
 		return -ENOSPC;
 
 	rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf, count);
-- 
2.53.0


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

end of thread, other threads:[~2026-06-05 14:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25  7:16 [PATCH] iio: backend: fix uninitialized data in debugfs Dan Carpenter
2026-05-25 13:20 ` Maxwell Doose
2026-05-26 18:19   ` Jonathan Cameron
2026-06-04  7:30     ` Andy Shevchenko
2026-06-04  7:38       ` Andy Shevchenko
2026-06-04  7:45       ` Dan Carpenter
2026-06-04  8:03         ` Andy Shevchenko
2026-06-04  8:28           ` Andy Shevchenko
2026-06-04 10:38             ` Dan Carpenter
2026-06-04 10:42               ` Dan Carpenter
2026-06-04 14:55                 ` Andy Shevchenko
2026-06-05  6:12                   ` Dan Carpenter
2026-06-05  8:28                     ` Andy Shevchenko
2026-06-05 14:38                       ` Maxwell Doose
2026-06-04 14:52               ` Andy Shevchenko

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.