[PATCH] drm/xe: check mask in xe_wait_user_fence_ioctl()
Matthew Brost
matthew.brost at intel.com
Fri Dec 8 12:34:23 UTC 2023
On Fri, Dec 08, 2023 at 02:34:27PM +0000, Francois Dugast wrote:
> Check the drm_xe_wait_user_fence mask is one of the allowed values
> DRM_XE_UFENCE_WAIT_MASK_* provided in xe_drm.h.
>
> Signed-off-by: Francois Dugast <francois.dugast at intel.com>
> ---
> drivers/gpu/drm/xe/xe_wait_user_fence.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> index 4d5c2555ce41..a73139fe3fe0 100644
> --- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
> +++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> @@ -164,6 +164,12 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
> if (XE_IOCTL_DBG(xe, args->num_engines > XE_HW_ENGINE_MAX_INSTANCE))
> return -EINVAL;
>
> + if (XE_IOCTL_DBG(xe, args->mask != DRM_XE_UFENCE_WAIT_MASK_U8 &&
> + args->mask != DRM_XE_UFENCE_WAIT_MASK_U16 &&
> + args->mask != DRM_XE_UFENCE_WAIT_MASK_U32 &&
> + args->mask != DRM_XE_UFENCE_WAIT_MASK_U64))
> + return -EINVAL;
> +
Why do we need this check? Looking at do_compare() I believe any mask
value actually works. Would it be better to just delete
DRM_XE_UFENCE_WAIT_MASK* from the uAPI?
Matt
> if (!no_engines) {
> err = copy_from_user(eci, user_eci,
> sizeof(struct drm_xe_engine_class_instance) *
> --
> 2.34.1
>
More information about the Intel-xe
mailing list