For a few subtypes of DRM_IOCTL_PVR_DEV_QUERY, driver was overriding
the returned size unconditionally. This would have resulted in
increase of reported size beyond the amount of data returned to
userspace when args->size < size of query structure.
Updated behaviour matches with the description of
drm_pvr_ioctl_dev_query_args.size and written byte length.
None of the structures of DRM_IOCTL_PVR_DEV_QUERY changed after addition,
so change will not break any compatibility with earlier version.
Fixes: f99f5f3ea7ef ("drm/imagination: Add GPU ID parsing and firmware loading")
Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
Reviewed-by: Alessio Belle <alessio.belle@imgtec.com>
Link: https://patch.msgid.link/20260701-b4-b4-query-v2-1-a1b491387875@imgtec.com
Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
if (err < 0)
return err;
- args->size = sizeof(query);
+ if (args->size > sizeof(query))
+ args->size = sizeof(query);
return 0;
}
if (err < 0)
return err;
- args->size = sizeof(query);
+ if (args->size > sizeof(query))
+ args->size = sizeof(query);
return 0;
}
if (err < 0)
return err;
- args->size = sizeof(query);
+ if (args->size > sizeof(query))
+ args->size = sizeof(query);
return 0;
}
if (err < 0)
return err;
- args->size = sizeof(query);
+ if (args->size > sizeof(query))
+ args->size = sizeof(query);
return 0;
}