Skip to content

Commit 2358da8

Browse files
error27gregkh
authored andcommitted
iio: dac: ad3552r-hs: fix uninitialized data ni ad3552r_hs_write_data_source()
commit eaaa7ee upstream. If the *ppos value is non-zero then the simple_write_to_buffer() function won't initialized the start of the buf[] buffer. Non-zero values for *ppos won't work here generally, so just test for them and return -ENOSPC at the start of the function. Fixes: b1c5d68 ("iio: dac: ad3552r-hs: add support for internal ramp") Signed-off-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Angelo Dureghello <adureghello@baylibre.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e166a8c commit 2358da8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/iio/dac/ad3552r-hs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static ssize_t ad3552r_hs_write_data_source(struct file *f,
549549

550550
guard(mutex)(&st->lock);
551551

552-
if (count >= sizeof(buf))
552+
if (*ppos != 0 || count >= sizeof(buf))
553553
return -ENOSPC;
554554

555555
ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf,

0 commit comments

Comments
 (0)