From: Dave Airlie <airl...@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 <airl...@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

Reply via email to