Skip to content

Commit c5f9362

Browse files
Dan Carpenterdakr
authored andcommitted
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: e3885f7 ("nouveau/u_memcpya: use vmemdup_user") Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Danilo Krummrich <dakr@redhat.com> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Danilo Krummrich <dakr@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/10fd258b-466f-4c5b-9d48-fe61a3f21424@moroto.mountain
1 parent e3885f7 commit c5f9362

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/nouveau/nouveau_drv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
193193
size_t bytes;
194194

195195
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
196-
return NULL;
196+
return ERR_PTR(-EOVERFLOW);
197197
return vmemdup_user(userptr, bytes);
198198
}
199199

0 commit comments

Comments
 (0)