* [PATCH] drm/gma500: fix memory disclosures due to uninitialized bytes
@ 2019-10-18 4:41 Kangjie Lu
2019-10-22 8:59 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-10-18 4:41 UTC (permalink / raw)
To: kjlu
Cc: Patrik Jakobsson, David Airlie, Daniel Vetter, dri-devel, linux-kernel
"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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/gma500: fix memory disclosures due to uninitialized bytes
2019-10-18 4:41 [PATCH] drm/gma500: fix memory disclosures due to uninitialized bytes Kangjie Lu
@ 2019-10-22 8:59 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2019-10-22 8:59 UTC (permalink / raw)
To: Kangjie Lu
Cc: Patrik Jakobsson, David Airlie, Daniel Vetter, dri-devel, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-22 8:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 4:41 [PATCH] drm/gma500: fix memory disclosures due to uninitialized bytes Kangjie Lu
2019-10-22 8:59 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).