public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Endriss <o.endriss@gmx.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	Derek Kelly <user.vdr@gmail.com>,
	"Hans J. Koch" <hjk@linutronix.de>, Jiri Kosina <jkosina@suse.cz>,
	Ben Pfaff <blp@cs.stanford.edu>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] av7110: wrong limiter in av7110_start_feed()
Date: Thu, 20 Oct 2011 23:39:31 +0000	[thread overview]
Message-ID: <201110210139.33912@orion.escape-edv.de> (raw)
In-Reply-To: <20111018061209.GF27732@elgon.mountain>

On Tuesday 18 October 2011 08:12:09 Dan Carpenter wrote:
> Smatch complains that the wrong limiter is used here:
> drivers/media/dvb/ttpci/av7110.c +906 dvb_feed_start_pid(12)
> 	error: buffer overflow 'npids' 5 <= 19
> 
> Here is the problem code:
>    905          i = dvbdmxfeed->pes_type;
>    906          npids[i] = (pid[i]&0x8000) ? 0 : pid[i];
> 
> "npids" is a 5 element array declared on the stack.  If
> dvbdmxfeed->pes_type is more than 4 we probably put a (u16)0 past
> the end of the array.
> 
> If dvbdmxfeed->pes_type is over 4 the rest of the function doesn't
> do anything.  dvbdmxfeed->pes_type is capped at less than
> DMX_TS_PES_OTHER (20) in the caller function, but I changed it to
> less than or equal to DMX_TS_PES_PCR (4).
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
> index 3d20719..abf6b55 100644
> --- a/drivers/media/dvb/ttpci/av7110.c
> +++ b/drivers/media/dvb/ttpci/av7110.c
> @@ -991,7 +991,7 @@ static int av7110_start_feed(struct dvb_demux_feed *feed)
>  
>  	if (feed->type = DMX_TYPE_TS) {
>  		if ((feed->ts_type & TS_DECODER) &&
> -		    (feed->pes_type < DMX_TS_PES_OTHER)) {
> +		    (feed->pes_type <= DMX_TS_PES_PCR)) {
>  			switch (demux->dmx.frontend->source) {
>  			case DMX_MEMORY_FE:
>  				if (feed->ts_type & TS_DECODER)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Acked-by: Oliver Endriss <o.endriss@gmx.de>

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
4 MByte Mod: http://www.escape-edv.de/endriss/dvb-mem-mod/
Full-TS Mod: http://www.escape-edv.de/endriss/dvb-full-ts-mod/
----------------------------------------------------------------

      reply	other threads:[~2011-10-20 23:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18  6:12 [patch] [media] av7110: wrong limiter in av7110_start_feed() Dan Carpenter
2011-10-20 23:39 ` Oliver Endriss [this message]

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=201110210139.33912@orion.escape-edv.de \
    --to=o.endriss@gmx.de \
    --cc=blp@cs.stanford.edu \
    --cc=dan.carpenter@oracle.com \
    --cc=hjk@linutronix.de \
    --cc=jkosina@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=user.vdr@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox