[PATCH] nouveau/u_memcpya: use kvmalloc_array.
Dave Airlie
airlied at gmail.com
Thu Aug 10 18:41:16 UTC 2023
From: Dave Airlie <airlied at redhat.com>
I think there are limit checks in places for most things but the
new api wants to not have them.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_drv.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 54063b094a69..6661f3057b72 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -192,9 +192,7 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
void *mem;
void __user *userptr = (void __force __user *)(uintptr_t)user;
- size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
+ mem = kvmalloc_array(nmemb, size, GFP_KERNEL);
if (!mem)
return ERR_PTR(-ENOMEM);
--
2.41.0
More information about the dri-devel
mailing list