From: Fei Yu <[email protected]>
On 11/17/26 10:39, Tvrtko Ursulin wrote:
> Therefore lets add a fast path to bypass the kmalloc_array/kfree and use a
> pre-allocated stack array for those cases.
Same as in 2/3, it's vmemdup_array_user()/kvmalloc_objs() now.
> @@ -1265,6 +1265,9 @@ static int drm_syncobj_array_wait(struct drm_device
> *dev,
> static int drm_syncobj_array_find(struct drm_file *file_private,
> void __user *user_handles,
> uint32_t count_handles,
> + uint32_t *stack_handles,
> + struct drm_syncobj **stack_syncobjs,
> + u32 stack_count,
> struct drm_syncobj ***syncobjs_out)
The handles array is freed before drm_syncobj_array_find() returns,
so the callers don't need to provide it. A local
"u32 stack_handles[DRM_SYNCOBJ_FAST_PATH_ENTRIES]" in
drm_syncobj_array_find() would do, and the six callers would only
declare and pass stack_syncobjs. Not a must, but it saves some
boilerplate. (Also u32 vs. uint32_t is mixed here.)
> - syncobjs = kvmalloc_objs(*syncobjs, count_handles);
> - if (syncobjs == NULL) {
> - ret = -ENOMEM;
> - goto err_free_handles;
> + syncobjs = kvmalloc_objs(*syncobjs, count_handles);;
Double semicolon (checkpatch warns).
The DRM_SYNCOBJ_MAX_HANDLES check stays in front of the fast/slow
split, good. With the ";;" fixed:
Reviewed-by: Fei Yu <[email protected]>
Thanks,
Fei