Input: serio_raw - initialize serio_raw_write() the return code
Subsystems (2)
PATCH 1/1 Input: serio_raw - initialize serio_raw_write() the return code
From: Arnd Bergmann <[email protected]>
The number of bytes returned from the write function is now undefined:
drivers/input/serio/serio_raw.c:204:12: error: variable 'written' is uninitialized when used here [-Werror,-Wuninitialized]
204 | return written ?: -EIO;
| ^~~~~~~
--- drivers/input/serio/serio_raw.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/serio/serio_raw.c +1 -0
@@ -195,6 +195,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer,if (count >32 ) count =32 ; + written =0 ;while (count--) {if (get_user (c, buffer++))return -EFAULT ;
Signature · 1 line
2.39.5
Dmitry Torokhov
maintainerHi Arnd,
Quoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The number of bytes returned from the write function is now undefined:
drivers/input/serio/serio_raw.c:204:12: error: variable 'written' is uninitialized when used here [-Werror,-Wuninitialized]
204 | return written ?:-EIO;
| ^~~~~~~
Thank you for the patch but I already have one fixing this up queued.
Quoted 26 lines
Fixes 5b53a9d40c4f ("Input: serio_raw - use guard notation for locks and other resources")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>--- drivers/input/serio/serio_raw.c | 1 + 1 file changed, 1 insertion(+)drivers/input/serio/serio_raw.c +1
-0@@ -195,6 +195,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer,if (count >32 ) count =32 ; + written =0 ;while (count--) {if (get_user (c, buffer++))return -EFAULT ;Signature · 1 line
2.39.5
Signature · 1 line
Dmitry