From: Daniel Vetter <daniel@ffwll.ch>
To: Kangjie Lu <kjlu@umn.edu>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/gma500: fix memory disclosures due to uninitialized bytes
Date: Tue, 22 Oct 2019 10:59:27 +0200 [thread overview]
Message-ID: <20191022085927.GA11828@phenom.ffwll.local> (raw)
In-Reply-To: <20191018044150.1899-1-kjlu@umn.edu>
On Thu, Oct 17, 2019 at 11:41:50PM -0500, Kangjie Lu wrote:
> "clock" may be copied to "best_clock". Initializing best_clock
> is not sufficient. The fix initializes clock as well to avoid
> memory disclosures and informaiton leaks.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Again no leak here, but also doesn't hurt, so applied.
-Daniel
> ---
> drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c
> index 167c10767dd4..900e5499249d 100644
> --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c
> +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c
> @@ -129,6 +129,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit,
> s32 freq_error, min_error = 100000;
>
> memset(best_clock, 0, sizeof(*best_clock));
> + memset(&clock, 0, sizeof(clock));
>
> for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) {
> for (clock.n = limit->n.min; clock.n <= limit->n.max;
> @@ -185,6 +186,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit,
> int err = target;
>
> memset(best_clock, 0, sizeof(*best_clock));
> + memset(&clock, 0, sizeof(clock));
>
> for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) {
> for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max;
> --
> 2.17.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2019-10-22 8:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 4:41 Kangjie Lu
2019-10-22 8:59 ` Daniel Vetter [this message]
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=20191022085927.GA11828@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=patrik.r.jakobsson@gmail.com \
/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
all inboxes | Powered by JetHome®