tty/vt: check allocation size in con_set_unimap()
PATCH 1/1 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.
Cc Kees Cook <[email protected]>
Signed-off-by Denis Efremov <[email protected]>
--- drivers/tty/vt/consolemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/vt/consolemap.c +1 -1
@@ -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);
Signature · 1 line
2.26.2
Quoted 5 lines · Denis Efremov
The
vmemdup_user()function has no 2-factor argument form. Usearray_size()to check for the overflow.Cc Kees Cook <[email protected]>Signed-off-by Denis Efremov <[email protected]>
Reviewed-by Kees Cook <[email protected]>
Signature · 1 line
Kees Cook