[PATCH] Input: serio_raw - initialize serio_raw_write() the return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Arnd Bergmann <arnd@xxxxxxxx>

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@xxxxxxxxx>
Reported-by: Dan Carpenter <error27@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@xxxxxxxxx/
Closes: https://lore.kernel.org/r/202410201759.qnyACw46-lkp@xxxxxxxxx/
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
 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





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux