Re: [PATCH] drm/i915: Add check for null dereference

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

 



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")

> 
> Discovered by klockwork static analysis.
> 
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> 
> Signed-off-by: Mika Kahola <mika.kahola@xxxxxxxxx>
> ---
>  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



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

  Powered by Linux