Commit 1a9a7143 authored by Boris Brezillon's avatar Boris Brezillon

drm/panthor: Don't check the array stride on empty uobj arrays

The user is likely to leave all the drm_panthor_obj_array fields
to zero when the array is empty, which will cause an EINVAL failure.

v2:
- Added R-bs

Fixes: 4bdca115 ("drm/panthor: Add the driver frontend block")
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240703071640.231278-2-boris.brezillon@collabora.com
parent 704c1bef
...@@ -86,15 +86,15 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride, ...@@ -86,15 +86,15 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride,
int ret = 0; int ret = 0;
void *out_alloc; void *out_alloc;
if (!in->count)
return NULL;
/* User stride must be at least the minimum object size, otherwise it might /* User stride must be at least the minimum object size, otherwise it might
* lack useful information. * lack useful information.
*/ */
if (in->stride < min_stride) if (in->stride < min_stride)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (!in->count)
return NULL;
out_alloc = kvmalloc_array(in->count, obj_size, GFP_KERNEL); out_alloc = kvmalloc_array(in->count, obj_size, GFP_KERNEL);
if (!out_alloc) if (!out_alloc)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment