From: Ben Greear <greearb@candelatech.com>
To: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/3] ath9k: fix 'side effect in macro' smatch warning
Date: Thu, 21 Jun 2012 12:15:26 -0700 [thread overview]
Message-ID: <4FE372CE.3020105@candelatech.com> (raw)
In-Reply-To: <20120621190716.GA30896@vmraj-lnx.users.atheros.com>
On 06/21/2012 12:07 PM, Rajkumar Manoharan wrote:
> On Thu, Jun 21, 2012 at 11:42:53AM -0700, Ben Greear wrote:
>> On 06/21/2012 11:31 AM, Rajkumar Manoharan wrote:
>>> 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>
>>> ---
>>> drivers/net/wireless/ath/ath9k/main.c | 9 +++++----
>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
>>> index 85f9ab4..32474b0 100644
>>> --- a/drivers/net/wireless/ath/ath9k/main.c
>>> +++ b/drivers/net/wireless/ath/ath9k/main.c
>>> @@ -2003,10 +2003,11 @@ static int ath9k_get_et_sset_count(struct ieee80211_hw *hw,
>>> #define PR_QNUM(_n) (sc->tx.txq_map[_n]->axq_qnum)
>>> #define AWDATA(elem) \
>>> 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)
>>
>> The macro is still changing i. So, whatever smatch is, seems it
>> should still warn, or it's broken :P
>>
> No it is not. The warning message is a hint. The smatch assumes that replacing
> the macro 'i++' might cause unexpected behaviour like 5++ in each statement.
Well, my opinion is that your patch only adds un-needed code and that
smatch is either currently giving false-positives, or that it is
missing a warning when you add your patch.
But, not a big deal either way.
Thanks,
Ben
>
> -Rajkumar
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
next prev parent reply other threads:[~2012-06-21 19:15 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 [this message]
2012-06-21 19:20 ` Rajkumar Manoharan
2012-06-22 7:17 ` Kalle Valo
2012-06-22 11:55 ` Dan Carpenter
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=4FE372CE.3020105@candelatech.com \
--to=greearb@candelatech.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 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.