[Intel-gfx] [PATCH] drm/i915: Add check for null dereference

Kahola, Mika mika.kahola at intel.com
Tue Sep 27 09:32:15 UTC 2022


> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Sent: Tuesday, September 27, 2022 12:27 PM
> To: Kahola, Mika <mika.kahola at intel.com>
> Cc: intel-gfx at lists.freedesktop.org; Nikula, Jani <jani.nikula at intel.com>
> Subject: Re: [PATCH] drm/i915: Add check for null dereference
> 
> On Tue, Sep 27, 2022 at 12:16:25PM +0300, Mika Kahola wrote:
> > fixed_mode in intel_edp_add_properties() function may be NULL which is
> > used later on in the function. Return early, in case of fixed_mode is
> > NULL to avoid NULL dereference.
> 
> Should no longer be possible:
> commit bde544e1d701 ("drm/i915: Don't init eDP if we can't find a fixed mode")

Ok. This one can then be marked as "not a problem" in clockwork.

-Mika-

> 
> >
> > Discovered by klockwork static analysis.
> >
> > Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > Cc: Jani Nikula <jani.nikula at intel.com>
> >
> > Signed-off-by: Mika Kahola <mika.kahola at intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_dp.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> > b/drivers/gpu/drm/i915/display/intel_dp.c
> > index 6ebd6e104b2c..db2541873f9d 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > @@ -5188,6 +5188,9 @@ intel_edp_add_properties(struct intel_dp *intel_dp)
> >  	const struct drm_display_mode *fixed_mode =
> >  		intel_panel_preferred_fixed_mode(connector);
> >
> > +	if (!fixed_mode)
> > +		return;
> > +
> >  	intel_attach_scaling_mode_property(&connector->base);
> >
> >  	drm_connector_set_panel_orientation_with_quirk(&connector->base,
> > --
> > 2.34.1
> 
> --
> Ville Syrjälä
> Intel


More information about the Intel-gfx mailing list