Jiri Slaby 07edff9265 vt: keyboard, reorder user buffer handling in vt_do_kdgkb_ioctl
KDGKBSENT (the getter) needs only 'user_kdgkb->kb_func' from the
userspace, i.e. the index. Then it needs a buffer for a local copy of
'kb_string'.

KDSKBSENT (the setter) needs a copy up to the length of
'user_kdgkb->kb_string'.

That means, we obtain the index before the switch-case and use it in
both paths and:
1) allocate full space in the getter case, and
2) copy the string only in the setter case. We do it by strndup_user
   helper now which was not available when this function was written.

Given we copy the two members of 'struct kbsentry' separately, we no
longer need a local definition. Hence we need to change all the sizeofs
here too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20201029113222.32640-11-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-04 16:43:38 +01:00
..
2020-11-04 16:40:32 +01:00
2019-11-13 19:01:14 +08:00
2019-04-16 15:21:34 +02:00
2020-06-27 16:21:20 +02:00
2020-08-31 07:19:25 +02:00
2020-08-31 07:19:25 +02:00
2020-08-18 13:51:18 +02:00
2020-10-28 13:44:43 +01:00
2020-04-27 09:33:21 +02:00
2020-08-18 13:51:18 +02:00
2020-08-18 13:51:18 +02:00
2020-08-18 13:51:18 +02:00
2020-08-18 13:51:18 +02:00
2020-08-18 13:51:18 +02:00
2020-08-18 13:51:18 +02:00
2020-08-18 13:51:18 +02:00
2019-04-16 15:21:34 +02:00