[Intel-gfx] [PATCH 1/5] Critical-KclockWork-Fixes-intel_atomi.c-PossibleNull

Nischal Varide nischal.varide at intel.com
Wed Aug 19 04:34:05 UTC 2020


This Patch fixes the Klocwork errors and the Current fix is avoiding
Possible Null Pointer Dereference

Signed-off-by: Nischal Varide <nischal.varide at intel.com>
---
 drivers/gpu/drm/i915/display/intel_atomic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
index 630f49b7aa01..cf51f1005ec1 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic.c
@@ -132,6 +132,9 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 		to_intel_digital_connector_state(old_state);
 	struct drm_crtc_state *crtc_state;
 
+	if (!(new_state && new_conn_state && old_state && old_conn_state))
+		return 0;
+
 	intel_hdcp_atomic_check(conn, old_state, new_state);
 	intel_psr_atomic_check(conn, old_state, new_state);
 
@@ -192,6 +195,8 @@ intel_connector_needs_modeset(struct intel_atomic_state *state,
 
 	old_conn_state = drm_atomic_get_old_connector_state(&state->base, connector);
 	new_conn_state = drm_atomic_get_new_connector_state(&state->base, connector);
+	if (!(old_conn_state && new_conn_state))
+		return 0;
 
 	return old_conn_state->crtc != new_conn_state->crtc ||
 	       (new_conn_state->crtc &&
@@ -418,7 +423,7 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
 	 */
 
 	/* fail if required scalers > available scalers */
-	if (num_scalers_need > intel_crtc->num_scalers){
+	if (num_scalers_need > intel_crtc->num_scalers) {
 		drm_dbg_kms(&dev_priv->drm,
 			    "Too many scaling requests %d > %d\n",
 			    num_scalers_need, intel_crtc->num_scalers);
-- 
2.26.0



More information about the Intel-gfx mailing list