aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-09-22 19:47:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:56 -0400
commitf7a595e98c3140f1271957aa742a6b84407620d4 (patch)
treee0566fee9bcebfc681d635fd430ccac87604e611 /drivers/video
parentdb8df7b0622cc6ddad993da2e4dfaf3b5d98ee30 (diff)
drivers/video/console/newport_con.c: fix read outside array bounds
It reads linetable[] before checking bounds of index, and ARRAY_SIZE is required because linetable[] are unsigned shorts. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console/newport_con.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index d31b203bf654..3772433c49d1 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -216,7 +216,7 @@ static void newport_get_screensize(void)
216 } 216 }
217 217
218 newport_xsize = newport_ysize = 0; 218 newport_xsize = newport_ysize = 0;
219 for (i = 0; linetable[i + 1] && (i < sizeof(linetable)); i += 2) { 219 for (i = 0; i < ARRAY_SIZE(linetable) - 1 && linetable[i + 1]; i += 2) {
220 cols = 0; 220 cols = 0;
221 newport_vc2_set(npregs, VC2_IREG_RADDR, linetable[i]); 221 newport_vc2_set(npregs, VC2_IREG_RADDR, linetable[i]);
222 npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM | 222 npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM |