Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Lasat: A couple off by one bugs in picvue_proc.c

These should be ">=" instead of ">" or we go past the end of the
pvc_lines[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mips@linux-mips.org
Cc: kernel-janitors@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/6124/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Dan Carpenter and committed by
Ralf Baechle
9b987c4d 2b436a35

+2 -2
+2 -2
arch/mips/lasat/picvue_proc.c
··· 43 43 { 44 44 int lineno = *(int *)m->private; 45 45 46 - if (lineno < 0 || lineno > PVC_NLINES) { 46 + if (lineno < 0 || lineno >= PVC_NLINES) { 47 47 printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno); 48 48 return 0; 49 49 } ··· 67 67 char kbuf[PVC_LINELEN]; 68 68 size_t len; 69 69 70 - BUG_ON(lineno < 0 || lineno > PVC_NLINES); 70 + BUG_ON(lineno < 0 || lineno >= PVC_NLINES); 71 71 72 72 len = min(count, sizeof(kbuf) - 1); 73 73 if (copy_from_user(kbuf, buf, len))