summaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorDenis Efremov <efremov@linux.com>2020-06-03 12:28:04 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-24 17:11:58 +0200
commit5de30b286e7166164f9e45de991bde26f5db8298 (patch)
treed173cc37c6d1f5eca98bd7029327fce9f757b53a /drivers/tty/vt
parentvt_ioctl: move perm checks level up (diff)
downloadlinux-5de30b286e7166164f9e45de991bde26f5db8298.tar.xz
linux-5de30b286e7166164f9e45de991bde26f5db8298.zip
tty/vt: check allocation size in con_set_unimap()
The vmemdup_user() function has no 2-factor argument form. Use array_size() to check for the overflow. Signed-off-by: Denis Efremov <efremov@linux.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20200603102804.2110817-1-efremov@linux.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/consolemap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index c1be96bb3ecf..5947b54d92be 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -542,7 +542,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
if (!ct)
return 0;
- unilist = vmemdup_user(list, ct * sizeof(struct unipair));
+ unilist = vmemdup_user(list, array_size(sizeof(struct unipair), ct));
if (IS_ERR(unilist))
return PTR_ERR(unilist);