[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <70318cbf0803042249j57d7f3a3j7666961a9132b10b@mail.gmail.com>
Date: Tue, 4 Mar 2008 22:49:47 -0800
From: "Christopher Li" <sparse@...isli.org>
To: "Ingo Molnar" <mingo@...e.hu>
Cc: "Julia Lawall" <julia@...u.dk>, yi.zhu@...el.com,
linux-wireless@...r.kernel.org,
ipw3945-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
"Harvey Harrison" <harvey.harrison@...il.com>,
"Alexander Viro" <viro@....linux.org.uk>,
linux-sparse@...r.kernel.org,
"Josh Triplett" <josh@...edesktop.org>
Subject: Re: [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and &
I think Al Viro has sent a patch to linux-sparse with subject
"[PATCH 3/3] catch !x & y brainos" does exactly that.
Chris
On Tue, Mar 4, 2008 at 10:38 PM, Ingo Molnar <mingo@...e.hu> wrote:
>
> * Julia Lawall <julia@...u.dk> wrote:
>
> > From: Julia Lawall <julia@...u.dk>
> >
> > In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed
> > that involved converting !x & y to !(x & y). The code below shows the
> > same pattern, and thus should perhaps be fixed in the same way.
>
>
> > if (sta_ht_inf) {
> > if ((!sta_ht_inf->ht_supported) ||
> > - (!sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))
> > + (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH)))
> > return 0;
>
> i'm wondering, could Sparse be extended to check for such patterns?
>
> People are regularly running "make C=1" and are sending fixes to make
> entire subsystems sparse-warning-free, so Sparse is a nice mechanism
> that works and it keeps code clean in the long run.
>
> I dont think the "!X & Y" pattern is ever used legitimately [and even if
> it were used legitimately, it's easy to avoid the sparse false positive
> - while in the buggy case we have a clear bug].
>
> Ingo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
>
>
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists