[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190311214708.GB24416@ravnborg.org>
Date: Mon, 11 Mar 2019 22:47:08 +0100
From: Sam Ravnborg <sam@...nborg.org>
To: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Gerd Hoffmann <kraxel@...hat.com>,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/atomic-helper: Validate pointer before dereference
Hi Rodrigo
On Mon, Mar 11, 2019 at 06:01:20PM -0300, Rodrigo Siqueira wrote:
> The function disable_outputs() and
> drm_atomic_helper_commit_modeset_enables() tries to retrieve
> helper_private from the target CRTC, for dereferencing some operations.
> However, the current implementation does not check whether
> helper_private is null and, if not, if it has a valid pointer to a dpms
> and commit functions. This commit adds pointer validations before
> trying to dereference the dpms and commit function.
>
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 30 ++++++++++++++++-------------
> 1 file changed, 17 insertions(+), 13 deletions(-)
>
> @@ -1277,11 +1279,13 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> if (new_crtc_state->enable) {
> DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
> crtc->base.id, crtc->name);
This DEBUG_ print is only relevant if the code actually
do something in the following.
So it seems more correct to fix the upper if () to:
> if (new_crtc_state->enable && funcs != NULL) {
> DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
...
The you also loose one indent and the calls are nicer.
(If used "funcs != NULL", but this is a matter of taste).
Sam
Powered by blists - more mailing lists