diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2006-03-11 03:27:27 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-11 09:19:36 -0800 |
commit | 8e6509876c5cb079f56dbe334aafaae9a293c886 (patch) | |
tree | 2c53657866458f3e94a8695cf8003263ec83af40 /drivers/video | |
parent | 54243cefdd3ab8133ebe7d3d705f35ca1d0b59eb (diff) | |
download | linux-3.10-8e6509876c5cb079f56dbe334aafaae9a293c886.tar.gz linux-3.10-8e6509876c5cb079f56dbe334aafaae9a293c886.tar.bz2 linux-3.10-8e6509876c5cb079f56dbe334aafaae9a293c886.zip |
[PATCH] aty128fb: Fix array overrun
Fix static array overrun
Coverity Bug 556
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/aty/aty128fb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index bfc8a93b2c7..620c9a934e0 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -1326,7 +1326,7 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll, unsigned char post_dividers[] = {1,2,4,8,3,6,12}; u32 output_freq; u32 vclk; /* in .01 MHz */ - int i; + int i = 0; u32 n, d; vclk = 100000000 / period_in_ps; /* convert units to 10 kHz */ @@ -1340,15 +1340,16 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll, /* now, find an acceptable divider */ for (i = 0; i < sizeof(post_dividers); i++) { output_freq = post_dividers[i] * vclk; - if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) + if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) { + pll->post_divider = post_dividers[i]; break; + } } /* calculate feedback divider */ n = c.ref_divider * output_freq; d = c.ref_clk; - pll->post_divider = post_dividers[i]; pll->feedback_divider = round_div(n, d); pll->vclk = vclk; |