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

Tvrtko Ursulin
2019-01-31T09:33:59Z

On 31/01/2019 09:15, Chris Wilson wrote:
> 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.

Looks I was thinking it is not user controllable eg. was supposed to be
the reminder of a too narrow internal type. But that is obviously not
true.. Also not sure why I did not use overflows_type for all.

Thanks,

Tvrtko