[PATCH 4/5] Fixing Possible Null Pointer Dereference.

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

 



A possible Null Pointer dereference of new_state,old_state, new_crtc_state
pointers from intel_tv.c is handled in this patch.

Signed-off-by: Nischal Varide <nischal.varide@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_tv.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
index 777032d9697b..5600d146ae81 100644
--- a/drivers/gpu/drm/i915/display/intel_tv.c
+++ b/drivers/gpu/drm/i915/display/intel_tv.c
@@ -1836,17 +1836,20 @@ static int intel_tv_atomic_check(struct drm_connector *connector,
 	struct drm_connector_state *old_state;
 
 	new_state = drm_atomic_get_new_connector_state(state, connector);
-	if (!new_state->crtc)
-		return 0;
-
 	old_state = drm_atomic_get_old_connector_state(state, connector);
 	new_crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
 
+	if (!(old_state && new_state && new_crtc_state))
+		return 0;
+
+	if (!new_state->crtc)
+		return 0;
+
 	if (old_state->tv.mode != new_state->tv.mode ||
-	    old_state->tv.margins.left != new_state->tv.margins.left ||
-	    old_state->tv.margins.right != new_state->tv.margins.right ||
-	    old_state->tv.margins.top != new_state->tv.margins.top ||
-	    old_state->tv.margins.bottom != new_state->tv.margins.bottom) {
+		old_state->tv.margins.left != new_state->tv.margins.left ||
+		old_state->tv.margins.right != new_state->tv.margins.right ||
+		old_state->tv.margins.top != new_state->tv.margins.top ||
+		old_state->tv.margins.bottom != new_state->tv.margins.bottom) {
 		/* Force a modeset. */
 
 		new_crtc_state->connectors_changed = true;
-- 
2.26.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



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

  Powered by Linux