From: Dmitry Torokhov Date: Mon, 21 Oct 2024 07:04:05 +0000 (-0700) Subject: Input: serio_raw - fix uninitialized variable bug X-Git-Tag: v6.13-rc1~95^2^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0c3a7aa814c091843ccca467c02078db9da4e1e;p=thirdparty%2Fkernel%2Flinux.git Input: serio_raw - fix uninitialized variable bug Recent conversion of the driver to use guard notation for locks and other resources introduced a bug: "written" variable that is supposed to hold number of bytes successfully written was not initialized. Fix it by initializing the variable with 0. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@intel.com/ Fixes: 5b53a9d40c4f ("Input: serio_raw - use guard notation for locks and other resources") Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index e058fef07f576..4d63950889860 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c @@ -185,7 +185,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer, { struct serio_raw_client *client = file->private_data; struct serio_raw *serio_raw = client->serio_raw; - int written; + int written = 0; unsigned char c; scoped_guard(mutex_intr, &serio_raw_mutex) {