drm/komeda: Potential error pointer dereference
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 3 May 2019 12:25:25 +0000 (15:25 +0300)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Thu, 6 Jun 2019 08:00:29 +0000 (09:00 +0100)
We need to check whether drm_atomic_get_crtc_state() returns an error
pointer before dereferencing "crtc_st".

Fixes: 9e5603094176 ("drm/komeda: Add komeda_plane/plane_helper_funcs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: "james qian wang (Arm Technology China)" <james.qian.wang@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
drivers/gpu/drm/arm/display/komeda/komeda_plane.c

index 0753892b98d276c566f37fa07600abe4711cd815..c97062bdd69b1b3a46c5298ce3402ed2e589af82 100644 (file)
@@ -63,7 +63,7 @@ komeda_plane_atomic_check(struct drm_plane *plane,
                return 0;
 
        crtc_st = drm_atomic_get_crtc_state(state->state, state->crtc);
-       if (!crtc_st->enable) {
+       if (IS_ERR(crtc_st) || !crtc_st->enable) {
                DRM_DEBUG_ATOMIC("Cannot update plane on a disabled CRTC.\n");
                return -EINVAL;
        }