aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <[email protected]>2023-09-15 15:59:21 +0300
committerDanilo Krummrich <[email protected]>2023-09-20 00:20:08 +0200
commitc5f9362307c685fe6a90d344bf81579578fd25d8 (patch)
treeb6e09213cde8f9b39fd2958a0cc5b08bafaf15b8
parente3885f71213437e7fa3e347d16b2bf59d03ae05d (diff)
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: e3885f712134 ("nouveau/u_memcpya: use vmemdup_user") Reviewed-by: Lyude Paul <[email protected]> Reviewed-by: Danilo Krummrich <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 3666a7403e47..e73a233c6572 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -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);
}