diff mbox series

nouveau/u_memcpya: use kvmalloc_array.

Message ID 20230810184116.230831-1-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series nouveau/u_memcpya: use kvmalloc_array. | expand

Commit Message

Dave Airlie Aug. 10, 2023, 6:41 p.m. UTC
From: Dave Airlie <airlied@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@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_drv.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

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);