From: Pavel Skripkin <paskripkin@gmail.com>
To: Jiri Slaby <jirislaby@kernel.org>, Ajay Garg <ajaygargnsit@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Greg KH <gregkh@linuxfoundation.org>,
kernel@esmil.dk, David Laight <David.Laight@aculab.com>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tty: vt: keyboard: do not copy an extra-byte in copy_to_user
Date: Wed, 10 Nov 2021 10:37:03 +0300 [thread overview]
Message-ID: <1305bb43-b4bf-e129-af6e-957d1f30f269@gmail.com> (raw)
In-Reply-To: <08c9e717-4367-5316-87cd-90b5ceb13ed9@kernel.org>
On 11/10/21 08:22, Jiri Slaby wrote:
> I don't quite understand what the problem is. Provided I wrote the code,
> is there something wrong with this commit (and its explanation), in
> particular?
>
> commit 6ca03f90527e499dd5e32d6522909e2ad390896b
> Author: Jiri Slaby <jirislaby@kernel.org>
> Date: Mon Oct 19 10:55:16 2020 +0200
>
> vt: keyboard, simplify vt_kdgkbsent
>
> Use 'strlen' of the string, add one for NUL terminator and simply do
> 'copy_to_user' instead of the explicit 'for' loop. This makes the
> KDGKBSENT case more compact.
>
> The only thing we need to take care about is NULL 'func_table[i]'. Use
> an empty string in that case.
>
> The original check for overflow could never trigger as the func_buf
> strings are always shorter or equal to 'struct kbsentry's.
>
> thanks,
>
As I said in my few previous emails, I don't see any bugs/problems in
current code.
Ajay wants to be safe and he thinks, that relying on fact, that
strlen(func_table[kb_func]) < sizeof(user_kdgkb->kb_string) is not good
approach, since it's external for vt_do_kdgkb_ioctl. (I hope, I've
explained his idea in the right way)
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2021-11-10 7:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 9:20 [PATCH] tty: vt: keyboard: do not copy an extra-byte in copy_to_user Ajay Garg
2021-11-06 11:23 ` Pavel Skripkin
2021-11-06 12:05 ` Ajay Garg
2021-11-06 12:39 ` Pavel Skripkin
2021-11-06 16:40 ` David Laight
2021-11-06 19:20 ` Ajay Garg
2021-11-06 19:46 ` Ajay Garg
2021-11-06 20:18 ` Pavel Skripkin
2021-11-06 20:30 ` Ajay Garg
2021-11-06 20:34 ` Pavel Skripkin
2021-11-06 20:44 ` Ajay Garg
2021-11-06 20:48 ` Pavel Skripkin
2021-11-08 8:59 ` Ajay Garg
2021-11-08 11:58 ` Pavel Skripkin
2021-11-08 12:12 ` Ajay Garg
2021-11-10 5:22 ` Jiri Slaby
2021-11-10 7:37 ` Pavel Skripkin [this message]
2021-11-10 8:57 ` Ajay Garg
2021-11-10 9:06 ` Greg KH
2021-11-10 9:32 ` Ajay Garg
2021-11-06 19:56 ` Pavel Skripkin
2021-11-06 20:07 ` Ajay Garg
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=1305bb43-b4bf-e129-af6e-957d1f30f269@gmail.com \
--to=paskripkin@gmail.com \
--cc=David.Laight@aculab.com \
--cc=ajaygargnsit@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel@esmil.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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