[Intel-gfx] [PATCH 6/6] drm/i915/dp: Sanitize link common rate array lookups

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Oct 20 10:09:36 UTC 2021


On Wed, Oct 20, 2021 at 12:53:52PM +0300, Jani Nikula wrote:
> On Wed, 20 Oct 2021, Imre Deak <imre.deak at intel.com> wrote:
> > On Tue, Oct 19, 2021 at 10:23:14PM +0300, Jani Nikula wrote:
> >> On Mon, 18 Oct 2021, Imre Deak <imre.deak at intel.com> wrote:
> >> > Add an assert that lookups from the intel_dp->common_rates[] array
> >> > are always valid.
> >> 
> >> The one thought I had here was that if we're adding helper functions for
> >> accessing common rates, they should probably be of the form "this is the
> >> rate I have now, give me a slower rate" instead of making the index part
> >> of the interface. The index doesn't really mean anything, and if we want
> >> to avoid overflows, it should be hidden from the interfaces.
> >
> > intel_dp_rate_index() is also part of the interface, but I suppose it
> > could be improved.
> 
> Most of its users could be converted to two functions:
> 
> - is this a valid rate?
> - give me a slower rate
> 
> The only place where index is actually needed is the eDP rate select
> method.
> 
> Pretty much everywhere I'm starting to prefer passing the actual values
> instead of mappings.

I think I had an ancient patch along those lines...
I guess I'm thinking of this one:
https://patchwork.freedesktop.org/patch/101471/?series=10354&rev=3

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list