diff options
author | Adam Borowski <kilobyte@angband.pl> | 2017-06-03 09:35:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-09 11:07:36 +0200 |
commit | 4f1be1b5d9aaef9c887140de5f2b9c2a989577d8 (patch) | |
tree | 0c3071bc8ac256be53bf35bd9b5c943c48298463 /drivers/tty/vt | |
parent | 915f0a8d2884d05538ae5c06e09f40d364fa2c3f (diff) | |
download | linux-stable-4f1be1b5d9aaef9c887140de5f2b9c2a989577d8.tar.gz linux-stable-4f1be1b5d9aaef9c887140de5f2b9c2a989577d8.tar.bz2 linux-stable-4f1be1b5d9aaef9c887140de5f2b9c2a989577d8.zip |
vt: use memdup_user in PIO_UNIMAP ioctl
Again, a nice linear transfer that simplifies the code.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r-- | drivers/tty/vt/consolemap.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index c6a692f63a9b..a5f88cf0f61d 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c @@ -540,14 +540,9 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) if (!ct) return 0; - unilist = kmalloc_array(ct, sizeof(struct unipair), GFP_KERNEL); - if (!unilist) - return -ENOMEM; - - for (i = ct, plist = unilist; i; i--, plist++, list++) { - __get_user(plist->unicode, &list->unicode); - __get_user(plist->fontpos, &list->fontpos); - } + unilist = memdup_user(list, ct * sizeof(struct unipair)); + if (IS_ERR(unilist)) + return PTR_ERR(unilist); console_lock(); |