linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kalle Valo <kvalo@adurom.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>,
	linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	Ben Greear <greearb@candelatech.com>
Subject: Re: [PATCH 3/3] ath9k: fix 'side effect in macro' smatch warning
Date: Fri, 22 Jun 2012 14:55:59 +0300	[thread overview]
Message-ID: <20120622115559.GD5390@mwanda> (raw)
In-Reply-To: <87ipej4xz0.fsf@purkki.adurom.net>

On Fri, Jun 22, 2012 at 10:17:23AM +0300, Kalle Valo wrote:
> Rajkumar Manoharan <rmanohar@qca.qualcomm.com> writes:
> 
> > ath9k_get_et_stats() warn: side effect in macro
> > 'AWDATA' doing 'i++'
> >
> > Cc: Ben Greear <greearb@candelatech.com>
> > Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
> 
> [...]
> 
> >  	do {								\
> > -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
> > -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
> > -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
> > -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
> > +		data[i+0] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
> > +		data[i+1] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
> > +		data[i+2] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
> > +		data[i+3] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
> > +		i += 4; \
> >  	} while (0)
> 
> I agree with Ben, this is a useless change as the end result is still
> the same (the side effect is that i is increased with four). You are
> just hiding that from smatch and once smatch is fixed it will warn again
> about the same thing.
> 
> I recommend fixing this properly so that the macro doesn't have any side
> effects.

Uh.  Sorry, also I thought I had pushed a fix to add this to the
ignored macro list, but I forgot.  I've pushed it now.

I don't think this check has ever found a bug.  These bugs are very
rare and we are careful about macro side effects in the kernel.  I
have disabled the check by default and it's only enabled when you
pass --spammy.  I told the Ruby people I was going to do this
earlier in the week but I've been out of the office and delayed.

regards,
dan carpenter


  reply	other threads:[~2012-06-22 11:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-21 18:31 [PATCH 0/3] ath9k: Fix smatch warnings Rajkumar Manoharan
2012-06-21 18:31 ` [PATCH 1/3] ath9k_hw: fix buffer overflow smatch warning Rajkumar Manoharan
2012-06-21 18:31 ` [PATCH 2/3] ath9k_hw: fix smatch warnings in spur_mitigate Rajkumar Manoharan
2012-06-22  7:23   ` Kalle Valo
2012-06-22  9:22     ` Rajkumar Manoharan
2012-06-22 11:44       ` Kalle Valo
2012-06-22 11:57         ` Dan Carpenter
2012-06-22 12:42           ` Rajkumar Manoharan
2012-06-21 18:31 ` [PATCH 3/3] ath9k: fix 'side effect in macro' smatch warning Rajkumar Manoharan
2012-06-21 18:42   ` Ben Greear
2012-06-21 19:07     ` Rajkumar Manoharan
2012-06-21 19:15       ` Ben Greear
2012-06-21 19:20         ` Rajkumar Manoharan
2012-06-22  7:17   ` Kalle Valo
2012-06-22 11:55     ` Dan Carpenter [this message]
2012-06-22 14:24       ` Ben Greear
2012-06-22 14:32         ` Dan Carpenter

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=20120622115559.GD5390@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=greearb@candelatech.com \
    --cc=kvalo@adurom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rmanohar@qca.qualcomm.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;
as well as URLs for NNTP newsgroup(s).