From: Jiri Slaby <jirislaby@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexey Gladkov <legion@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Cc: Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: vt/keyboard: Hoist and reuse variable in vt_do_kdgkb_ioctl
Date: Fri, 27 Feb 2026 08:22:11 +0100 [thread overview]
Message-ID: <78bf91c6-8dd7-4c69-bd9f-61551990f02d@kernel.org> (raw)
In-Reply-To: <20260226123419.737669-1-thorsten.blum@linux.dev>
On 26. 02. 26, 13:34, Thorsten Blum wrote:
> Hoist 'len' and use it in both cases.
>
> The last 'kbs' assignment is useless and a leftover from commit
> bfb24564b5fd ("tty: vt/keyboard: use __free()"). Remove it.
No, kbs is set to NULL by vt_kdskbsent() when it should NOT be freed.
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/tty/vt/keyboard.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index d65fc60dd7be..6a1044f87216 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
...
> @@ -2022,12 +2023,12 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
> return -EPERM;
>
> char __free(kfree) *kbs = strndup_user(user_kdgkb->kb_string,
> - sizeof(user_kdgkb->kb_string));
> + len);
> if (IS_ERR(kbs))
> return PTR_ERR(kbs);
>
> guard(spinlock_irqsave)(&func_buf_lock);
> - kbs = vt_kdskbsent(kbs, kb_func);
> + vt_kdskbsent(kbs, kb_func);
--
js
suse labs
next prev parent reply other threads:[~2026-02-27 7:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 12:34 [PATCH] tty: vt/keyboard: Hoist and reuse variable in vt_do_kdgkb_ioctl Thorsten Blum
2026-02-27 7:22 ` Jiri Slaby [this message]
2026-02-27 10:21 ` Thorsten Blum
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=78bf91c6-8dd7-4c69-bd9f-61551990f02d@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=legion@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=myrrhperiwinkle@qtmlabs.xyz \
--cc=nathan@kernel.org \
--cc=tglx@kernel.org \
--cc=thorsten.blum@linux.dev \
/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