diff options
| author | Dan Carpenter <error27@gmail.com> | 2026-05-25 10:16:27 +0300 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2026-05-26 21:22:57 +0300 |
| commit | ab92ed206d41fd171ebd37bc46360d9f2140d043 (patch) | |
| tree | 0598df25ae05f85d9c1c79fcf5076df1acd46835 | |
| parent | a6e8b14a4897d0b6df9744f33d0a30e6b92368eb (diff) | |
| download | linux-ab92ed206d41fd171ebd37bc46360d9f2140d043.tar.xz | |
iio: core: fix uninitialized data in debugfs
If *ppos is non-zero then simple_write_to_buffer() will not initialize
the start of buf[]. Non zero values for *ppos aren't going to work
anyway. Test for them at the start of the function and return -EINVAL.
Fixes: 6d5dd486c715 ("iio: core: make use of simple_write_to_buffer()")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| -rw-r--r-- | drivers/iio/industrialio-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 22eefd048ba9..15b56f8972fc 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -418,7 +418,7 @@ static ssize_t iio_debugfs_write_reg(struct file *file, char buf[80]; int ret; - if (count >= sizeof(buf)) + if (*ppos != 0 || count >= sizeof(buf)) return -EINVAL; ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf, |
