Skip to contentSkip to conversation

nouveau/u_memcpya: use kvmalloc_array.

PATCH New Dave Airlie 1 participant 1 message Aug 10, 2023

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 nouveau/u_memcpya: use kvmalloc_array.

From: Dave Airlie <[email protected]>

I think there are limit checks in places for most things but the new api wants to not have them.

---
 drivers/gpu/drm/nouveau/nouveau_drv.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drv.h +1 -3
index 54063b094a69..6661f3057b72 100644
@@ -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);
 
Signature · 1 line
2.41.0