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
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx