From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] Input: serio_raw: Fix uninitialized variable 'written'
Date: Mon, 21 Oct 2024 12:20:02 -0700 [thread overview]
Message-ID: <ZxapYkZAgxXBTJsb@google.com> (raw)
In-Reply-To: <20241021144103.928386-1-colin.i.king@gmail.com>
Hi Colin,
On Mon, Oct 21, 2024 at 03:41:03PM +0100, Colin Ian King wrote:
> The variable written is not initialized and subsequent increments of the
> variable are using an uninitialized value. Fix this by initializating it
> at the start of the function.
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")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/input/serio/serio_raw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
> index e058fef07f57..4d6395088986 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) {
> --
> 2.39.5
>
--
Dmitry
prev parent reply other threads:[~2024-10-21 19:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 14:41 [PATCH][next] Input: serio_raw: Fix uninitialized variable 'written' Colin Ian King
2024-10-21 19:20 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZxapYkZAgxXBTJsb@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=colin.i.king@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).