]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vt: keyboard, simplify vt_kdgkbsent
authorJiri Slaby <jslaby@suse.cz>
Mon, 19 Oct 2020 08:55:16 +0000 (10:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:08:50 +0000 (11:08 +0100)
commit20cf3fcdd646735346fca7bbf365b74bf0988034
treee0e6fe8aafd98afa98f4de64444d56ee608663d4
parentd1dff15c809e93af022da03f4663b8ac93e3d1c9
vt: keyboard, simplify vt_kdgkbsent

commit 6ca03f90527e499dd5e32d6522909e2ad390896b upstream.

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.

Cc: <stable@vger.kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20201019085517.10176-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/keyboard.c