Skip to content

Commit

Permalink
Input: serio_raw - fix uninitialized variable bug
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dtor committed Oct 21, 2024
1 parent 00850d7 commit d0c3a7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/serio/serio_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d0c3a7a

Please sign in to comment.