Commit c5f93623 authored by Dan Carpenter's avatar Dan Carpenter Committed by Danilo Krummrich

nouveau/u_memcpya: fix NULL vs error pointer bug

The u_memcpya() function is supposed to return error pointers on
error. Returning NULL will lead to an Oops.

Fixes: e3885f71 ("nouveau/u_memcpya: use vmemdup_user")
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarDanilo Krummrich <dakr@redhat.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/10fd258b-466f-4c5b-9d48-fe61a3f21424@moroto.mountain
parent e3885f71
......@@ -193,7 +193,7 @@ u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
size_t bytes;
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
return NULL;
return ERR_PTR(-EOVERFLOW);
return vmemdup_user(userptr, bytes);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment