* [PATCH] Input: serio_raw - initialize serio_raw_write() the return code
@ 2024-10-21 10:38 Arnd Bergmann
2024-10-21 19:19 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-10-21 10:38 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Arnd Bergmann, kernel test robot, Dan Carpenter, Erick Archer,
linux-input, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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;
| ^~~~~~~
Fixes: 5b53a9d40c4f ("Input: serio_raw - use guard notation for locks and other resources")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@intel.com/
Closes: https://lore.kernel.org/r/202410201759.qnyACw46-lkp@intel.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/input/serio/serio_raw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index e058fef07f57..55fe77d04089 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -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;
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: serio_raw - initialize serio_raw_write() the return code
2024-10-21 10:38 [PATCH] Input: serio_raw - initialize serio_raw_write() the return code Arnd Bergmann
@ 2024-10-21 19:19 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2024-10-21 19:19 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, kernel test robot, Dan Carpenter, Erick Archer,
linux-input, linux-kernel
Hi Arnd,
On Mon, Oct 21, 2024 at 10:38:27AM +0000, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Fixes: 5b53a9d40c4f ("Input: serio_raw - use guard notation for locks and other resources")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@intel.com/
> Closes: https://lore.kernel.org/r/202410201759.qnyACw46-lkp@intel.com/
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/input/serio/serio_raw.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
> index e058fef07f57..55fe77d04089 100644
> --- a/drivers/input/serio/serio_raw.c
> +++ b/drivers/input/serio/serio_raw.c
> @@ -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;
> --
> 2.39.5
>
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-21 19:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 10:38 [PATCH] Input: serio_raw - initialize serio_raw_write() the return code Arnd Bergmann
2024-10-21 19:19 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).