* [PATCH] newport_con: Read outside array bounds
@ 2009-07-29 19:20 Roel Kluin
0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-07-29 19:20 UTC (permalink / raw)
To: LKML, Andrew Morton
It read 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>
---
This one wasn't spotted by parfait.
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index d31b203..3772433 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)
}
newport_xsize = newport_ysize = 0;
- for (i = 0; linetable[i + 1] && (i < sizeof(linetable)); i += 2) {
+ for (i = 0; i < ARRAY_SIZE(linetable) - 1 && linetable[i + 1]; i += 2) {
cols = 0;
newport_vc2_set(npregs, VC2_IREG_RADDR, linetable[i]);
npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM |
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-07-29 19:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-29 19:20 [PATCH] newport_con: Read outside array bounds Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox