Skip to content

Commit d0c3a7a

Browse files
committed
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 <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 5b53a9d ("Input: serio_raw - use guard notation for locks and other resources") Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 00850d7 commit d0c3a7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/serio/serio_raw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer,
185185
{
186186
struct serio_raw_client *client = file->private_data;
187187
struct serio_raw *serio_raw = client->serio_raw;
188-
int written;
188+
int written = 0;
189189
unsigned char c;
190190

191191
scoped_guard(mutex_intr, &serio_raw_mutex) {

0 commit comments

Comments
 (0)