Skip to content

Commit

Permalink
MIPS: Lasat: A couple off by one bugs in picvue_proc.c
Browse files Browse the repository at this point in the history
These should be ">=" instead of ">" or we go past the end of the
pvc_lines[] array.

Signed-off-by: Dan Carpenter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/6124/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
Dan Carpenter authored and ralfbaechle committed May 28, 2016
1 parent 2b436a3 commit 9b987c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/mips/lasat/picvue_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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;
}
Expand All @@ -67,7 +67,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))
Expand Down

0 comments on commit 9b987c4

Please sign in to comment.