[Intel-gfx] [PATCH v30 4/5] drm/i915: Expose RPCS (SSEU) configuration to userspace (Gen11 only)

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 31 09:15:25 UTC 2019


Quoting Tvrtko Ursulin (2019-01-31 08:47:37)
> +       /*
> +        * Some future proofing on the types since the uAPI is wider than the
> +        * current internal implementation.
> +        */
> +       if (WARN_ON((fls(user->slice_mask) >
> +                    sizeof(context->slice_mask) * BITS_PER_BYTE) ||
> +                   (fls(user->subslice_mask) >
> +                    sizeof(context->subslice_mask) * BITS_PER_BYTE) ||
> +                   overflows_type(user->min_eus_per_subslice,
> +                                  context->min_eus_per_subslice) ||
> +                   overflows_type(user->max_eus_per_subslice,
> +                                  context->max_eus_per_subslice)))

fls(0) is not well-defined, so 

if (order_base_2(user->slice_mask) > BITS_PER_TYPE(context->slice_mask))
	return -EINVAL;

etc

Don't WARN_ON() for user controlled variables.
-Chris


More information about the Intel-gfx mailing list