From: Sam Ravnborg <sam@ravnborg.org>
To: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
Gerd Hoffmann <kraxel@redhat.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/atomic-helper: Validate pointer before dereference
Date: Mon, 11 Mar 2019 22:47:08 +0100 [thread overview]
Message-ID: <20190311214708.GB24416@ravnborg.org> (raw)
In-Reply-To: <20190311210120.fdixvenmqjoxuoqt@smtp.gmail.com>
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@gmail.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
next prev parent reply other threads:[~2019-03-11 21:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 21:01 [PATCH] drm/atomic-helper: Validate pointer before dereference Rodrigo Siqueira
2019-03-11 21:47 ` Sam Ravnborg [this message]
2019-03-12 6:59 ` Gerd Hoffmann
2019-03-12 11:00 ` Daniel Vetter
2019-03-12 11:50 ` Rodrigo Siqueira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190311214708.GB24416@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=rodrigosiqueiramelo@gmail.com \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox