public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [MIPS] Lasat: a couple off by one bugs in picvue_proc.c
@ 2013-11-08  9:44 Dan Carpenter
  2014-04-02 16:52 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-11-08  9:44 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, kernel-janitors

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>

diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c
index 638c5db..8c55de4 100644
--- a/arch/mips/lasat/picvue_proc.c
+++ b/arch/mips/lasat/picvue_proc.c
@@ -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))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] [MIPS] Lasat: a couple off by one bugs in picvue_proc.c
  2013-11-08  9:44 [patch] [MIPS] Lasat: a couple off by one bugs in picvue_proc.c Dan Carpenter
@ 2014-04-02 16:52 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-04-02 16:52 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, kernel-janitors

These off by one bugs are still there in linux-next.

regards,
dan carpenter

On Fri, Nov 08, 2013 at 12:44:31PM +0300, Dan Carpenter wrote:
> 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>
> 
> diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c
> index 638c5db..8c55de4 100644
> --- a/arch/mips/lasat/picvue_proc.c
> +++ b/arch/mips/lasat/picvue_proc.c
> @@ -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))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-02 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08  9:44 [patch] [MIPS] Lasat: a couple off by one bugs in picvue_proc.c Dan Carpenter
2014-04-02 16:52 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox