Commit 9b987c4d authored by Dan Carpenter's avatar Dan Carpenter Committed by Ralf Baechle

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: default avatarDan 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: default avatarRalf Baechle <ralf@linux-mips.org>
parent 2b436a35
...@@ -43,7 +43,7 @@ static int pvc_line_proc_show(struct seq_file *m, void *v) ...@@ -43,7 +43,7 @@ static int pvc_line_proc_show(struct seq_file *m, void *v)
{ {
int lineno = *(int *)m->private; 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); printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno);
return 0; return 0;
} }
...@@ -67,7 +67,7 @@ static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, ...@@ -67,7 +67,7 @@ static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
char kbuf[PVC_LINELEN]; char kbuf[PVC_LINELEN];
size_t len; size_t len;
BUG_ON(lineno < 0 || lineno > PVC_NLINES); BUG_ON(lineno < 0 || lineno >= PVC_NLINES);
len = min(count, sizeof(kbuf) - 1); len = min(count, sizeof(kbuf) - 1);
if (copy_from_user(kbuf, buf, len)) if (copy_from_user(kbuf, buf, len))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment