]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MIPS: Lasat: A couple off by one bugs in picvue_proc.c
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Nov 2013 09:44:31 +0000 (12:44 +0300)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 15 Nov 2013 23:25:50 +0000 (00:25 +0100)
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>
arch/mips/lasat/picvue_proc.c

index 638c5db122c924dca997725d58ee0fd34b36fe1b..8c55de42693d2bcd73420654f45bb050c3e2c696 100644 (file)
@@ -44,7 +44,7 @@ static int pvc_line_proc_show(struct seq_file *m, void *v)
 {
        int lineno = *(int *)m->private;
 
-       if (lineno < 0 || lineno > PVC_NLINES) {
+       if (lineno < 0 || lineno >= PVC_NLINES) {
                printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno);
                return 0;
        }
@@ -68,7 +68,7 @@ static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
        char kbuf[PVC_LINELEN];
        size_t len;
 
-       BUG_ON(lineno < 0 || lineno > PVC_NLINES);
+       BUG_ON(lineno < 0 || lineno >= PVC_NLINES);
 
        len = min(count, sizeof(kbuf) - 1);
        if (copy_from_user(kbuf, buf, len))