All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH 2/5] [media] cx24110: Fix a spatch warning
Date: Wed, 05 Nov 2014 13:21:31 +0100	[thread overview]
Message-ID: <545A164B.2010908@xs4all.nl> (raw)
In-Reply-To: <b8e64df00231a4c4d59b68d8eda9f8db1adc1ea4.1415188985.git.mchehab@osg.samsung.com>

spatch or smatch? I assume smatch :-)

BTW, I've just added smatch support to the daily build.

Regards,

	Hans

On 11/05/14 13:03, Mauro Carvalho Chehab wrote:
> This is actually a false positive:
> 	drivers/media/dvb-frontends/cx24110.c:210 cx24110_set_fec() error: buffer overflow 'rate' 7 <= 8
> 
> But fixing it is easy: just ensure that the table size will be
> limited to FEC_AUTO.
> 
> While here, fix spacing on the affected lines.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/dvb-frontends/cx24110.c b/drivers/media/dvb-frontends/cx24110.c
> index 95b981cd7115..e78e7893e8aa 100644
> --- a/drivers/media/dvb-frontends/cx24110.c
> +++ b/drivers/media/dvb-frontends/cx24110.c
> @@ -181,16 +181,16 @@ static int cx24110_set_fec (struct cx24110_state* state, fe_code_rate_t fec)
>  {
>  /* fixme (low): error handling */
>  
> -	static const int rate[]={-1,1,2,3,5,7,-1};
> -	static const int g1[]={-1,0x01,0x02,0x05,0x15,0x45,-1};
> -	static const int g2[]={-1,0x01,0x03,0x06,0x1a,0x7a,-1};
> +	static const int rate[FEC_AUTO] = {-1,    1,    2,    3,    5,    7, -1};
> +	static const int g1[FEC_AUTO]   = {-1, 0x01, 0x02, 0x05, 0x15, 0x45, -1};
> +	static const int g2[FEC_AUTO]   = {-1, 0x01, 0x03, 0x06, 0x1a, 0x7a, -1};
>  
>  	/* Well, the AutoAcq engine of the cx24106 and 24110 automatically
>  	   searches all enabled viterbi rates, and can handle non-standard
>  	   rates as well. */
>  
> -	if (fec>FEC_AUTO)
> -		fec=FEC_AUTO;
> +	if (fec > FEC_AUTO)
> +		fec = FEC_AUTO;
>  
>  	if (fec==FEC_AUTO) { /* (re-)establish AutoAcq behaviour */
>  		cx24110_writereg(state,0x37,cx24110_readreg(state,0x37)&0xdf);
> 


  reply	other threads:[~2014-11-05 12:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 12:03 [PATCH 1/5] [media] cx22700: Fix potential buffer overflow Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 2/5] [media] cx24110: Fix a spatch warning Mauro Carvalho Chehab
2014-11-05 12:21   ` Hans Verkuil [this message]
2014-11-05 12:41     ` Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 3/5] [media] cx24110: Fix whitespaces at cx24110_set_fec() Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 4/5] [media] cx23110: Fix return code for cx24110_set_fec() Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 5/5] [media] cx24110: Simplify error handling at cx24110_set_fec() Mauro Carvalho Chehab

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=545A164B.2010908@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@osg.samsung.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 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.