提交 f7a595e9 编写于 作者: R Roel Kluin 提交者: Linus Torvalds

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: NRoel Kluin <roel.kluin@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 db8df7b0
......@@ -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 |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册