aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-03-11 06:27:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-11 12:19:36 -0500
commit8e6509876c5cb079f56dbe334aafaae9a293c886 (patch)
tree2c53657866458f3e94a8695cf8003263ec83af40 /drivers/video
parent54243cefdd3ab8133ebe7d3d705f35ca1d0b59eb (diff)
[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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index bfc8a93b2c73..620c9a934e0e 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,
1326 unsigned char post_dividers[] = {1,2,4,8,3,6,12}; 1326 unsigned char post_dividers[] = {1,2,4,8,3,6,12};
1327 u32 output_freq; 1327 u32 output_freq;
1328 u32 vclk; /* in .01 MHz */ 1328 u32 vclk; /* in .01 MHz */
1329 int i; 1329 int i = 0;
1330 u32 n, d; 1330 u32 n, d;
1331 1331
1332 vclk = 100000000 / period_in_ps; /* convert units to 10 kHz */ 1332 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,
1340 /* now, find an acceptable divider */ 1340 /* now, find an acceptable divider */
1341 for (i = 0; i < sizeof(post_dividers); i++) { 1341 for (i = 0; i < sizeof(post_dividers); i++) {
1342 output_freq = post_dividers[i] * vclk; 1342 output_freq = post_dividers[i] * vclk;
1343 if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) 1343 if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) {
1344 pll->post_divider = post_dividers[i];
1344 break; 1345 break;
1346 }
1345 } 1347 }
1346 1348
1347 /* calculate feedback divider */ 1349 /* calculate feedback divider */
1348 n = c.ref_divider * output_freq; 1350 n = c.ref_divider * output_freq;
1349 d = c.ref_clk; 1351 d = c.ref_clk;
1350 1352
1351 pll->post_divider = post_dividers[i];
1352 pll->feedback_divider = round_div(n, d); 1353 pll->feedback_divider = round_div(n, d);
1353 pll->vclk = vclk; 1354 pll->vclk = vclk;
1354 1355