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

Mika Kahola mika.kahola at intel.com
Tue Sep 27 09:16:25 UTC 2022


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.

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



More information about the Intel-gfx mailing list