* [PATCH] tty/vt: check allocation size in con_set_unimap()
@ 2020-06-03 10:28 Denis Efremov
2020-06-03 19:13 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Denis Efremov @ 2020-06-03 10:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Denis Efremov, linux-kernel, Kees Cook
The vmemdup_user() function has no 2-factor argument form. Use array_size()
to check for the overflow.
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Denis Efremov <efremov@linux.com>
---
drivers/tty/vt/consolemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index b28aa0d289f8..32acea9e8270 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);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tty/vt: check allocation size in con_set_unimap()
2020-06-03 10:28 [PATCH] tty/vt: check allocation size in con_set_unimap() Denis Efremov
@ 2020-06-03 19:13 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2020-06-03 19:13 UTC (permalink / raw)
To: Denis Efremov; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel
On Wed, Jun 03, 2020 at 01:28:04PM +0300, Denis Efremov wrote:
> The vmemdup_user() function has no 2-factor argument form. Use array_size()
> to check for the overflow.
>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Denis Efremov <efremov@linux.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-03 19:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 10:28 [PATCH] tty/vt: check allocation size in con_set_unimap() Denis Efremov
2020-06-03 19:13 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).