Skip to content

Commit

Permalink
vt: use memdup_user in PIO_UNIMAP ioctl
Browse files Browse the repository at this point in the history
Again, a nice linear transfer that simplifies the code.

Signed-off-by: Adam Borowski <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
kilobyte authored and gregkh committed Jun 9, 2017
1 parent 915f0a8 commit 4f1be1b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/tty/vt/consolemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 4f1be1b

Please sign in to comment.