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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux