From: Dan Carpenter Date: Fri, 3 May 2019 12:25:25 +0000 (+0300) Subject: drm/komeda: Potential error pointer dereference X-Git-Tag: v5.4-rc1~827^2~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d10dc617b4128c06fc2a88b47fda0a183ffe36c;p=platform%2Fkernel%2Flinux-rpi.git drm/komeda: Potential error pointer dereference 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 Reviewed-by: "james qian wang (Arm Technology China)" Signed-off-by: Liviu Dudau --- diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index 0753892..c97062b 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -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; }