All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@nokia.com>
To: Dan Carpenter <error27@gmail.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Trent Piepho <xyzzy@speakeasy.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [patch] omap24xxcam: potential buffer overflow
Date: Wed, 10 Mar 2010 21:47:37 +0000	[thread overview]
Message-ID: <4B981379.1050704@nokia.com> (raw)
In-Reply-To: <20100310105703.GD6321@bicker>

Dan Carpenter wrote:
> The previous loop goes until last = VIDEO_MAX_FRAME, so this could 
> potentially go one past the end of the loop.

Hi Dan,

Thanks for the patch!

> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
> index 142c327..bedbee9 100644
> --- a/drivers/media/video/omap24xxcam.c
> +++ b/drivers/media/video/omap24xxcam.c
> @@ -1404,7 +1404,7 @@ static int omap24xxcam_mmap_buffers(struct file *file,
>  	}
>  
>  	size = 0;
> -	for (i = first; i <= last; i++) {
> +	for (i = first; i <= last && i < VIDEO_MAX_FRAME; i++) {
>  		struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]);
>  
>  		for (j = 0; j < dma->sglen; j++) {

That function is quite an ugly piece of code... This patch fixes an
obvious bug in it.

Acked-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

WARNING: multiple messages have this Message-ID (diff)
From: Sakari Ailus <sakari.ailus@nokia.com>
To: Dan Carpenter <error27@gmail.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Trent Piepho <xyzzy@speakeasy.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [patch] omap24xxcam: potential buffer overflow
Date: Wed, 10 Mar 2010 23:47:37 +0200	[thread overview]
Message-ID: <4B981379.1050704@nokia.com> (raw)
In-Reply-To: <20100310105703.GD6321@bicker>

Dan Carpenter wrote:
> The previous loop goes until last == VIDEO_MAX_FRAME, so this could 
> potentially go one past the end of the loop.

Hi Dan,

Thanks for the patch!

> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
> index 142c327..bedbee9 100644
> --- a/drivers/media/video/omap24xxcam.c
> +++ b/drivers/media/video/omap24xxcam.c
> @@ -1404,7 +1404,7 @@ static int omap24xxcam_mmap_buffers(struct file *file,
>  	}
>  
>  	size = 0;
> -	for (i = first; i <= last; i++) {
> +	for (i = first; i <= last && i < VIDEO_MAX_FRAME; i++) {
>  		struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]);
>  
>  		for (j = 0; j < dma->sglen; j++) {

That function is quite an ugly piece of code... This patch fixes an
obvious bug in it.

Acked-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

  reply	other threads:[~2010-03-10 21:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 10:57 [patch] omap24xxcam: potential buffer overflow Dan Carpenter
2010-03-10 10:57 ` Dan Carpenter
2010-03-10 21:47 ` Sakari Ailus [this message]
2010-03-10 21:47   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B981379.1050704@nokia.com \
    --to=sakari.ailus@nokia.com \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=xyzzy@speakeasy.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.