Skip to content

Commit

Permalink
drm/gma500: fix memory disclosures due to uninitialized bytes
Browse files Browse the repository at this point in the history
"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 <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
kengiter authored and danvet committed Oct 22, 2019
1 parent 57a25a5 commit ec3b7b6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/gma500/oaktrail_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ec3b7b6

Please sign in to comment.