Skip to content

Commit 1a9a714

Browse files
committed
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: 4bdca11 ("drm/panthor: Add the driver frontend block") Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Liviu Dudau <[email protected]> Reviewed-by: Steven Price <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 704c1be commit 1a9a714

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/panthor/panthor_drv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride,
8686
int ret = 0;
8787
void *out_alloc;
8888

89+
if (!in->count)
90+
return NULL;
91+
8992
/* User stride must be at least the minimum object size, otherwise it might
9093
* lack useful information.
9194
*/
9295
if (in->stride < min_stride)
9396
return ERR_PTR(-EINVAL);
9497

95-
if (!in->count)
96-
return NULL;
97-
9898
out_alloc = kvmalloc_array(in->count, obj_size, GFP_KERNEL);
9999
if (!out_alloc)
100100
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)