* Re: [wireless-next:master 70/102] drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff)
[not found] ` <CACna6ryGg4NY2ecDjCKckXk8QXSJWVpbWWtdya9JRB618G92wQ@mail.gmail.com>
@ 2014-09-16 2:17 ` Fengguang Wu
2014-09-16 7:20 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Fengguang Wu @ 2014-09-16 2:17 UTC (permalink / raw)
To: Rafał Miłecki
Cc: John W. Linville, kbuild-all, Christopher Li, Linux-Sparse
I could disable this warning in my reports, but CC sparse authors
first to check if there are more elegant solutions.
On Mon, Sep 15, 2014 at 11:16:09PM +0200, Rafał Miłecki wrote:
> On 15 September 2014 21:50, kbuild test robot <fengguang.wu@intel.com> wrote:
> > tree: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master
> > head: 1030f9fe65602465a89beaa05c3343cf9fd68a88
> > commit: 1f21de53ac8651b1a3e79576f1adf00aabecd052 [70/102] b43: HT-PHY: Implement band switching
> > reproduce:
> > # apt-get install sparse
> > git checkout 1f21de53ac8651b1a3e79576f1adf00aabecd052
> > make ARCH=x86_64 allmodconfig
> > make C=1 CF=-D__CHECK_ENDIAN__
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> >
> >>> drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff)
> >
> > vim +338 drivers/net/wireless/b43/phy_ht.c
>
> I already got the same sparse warning twice (for different parts of code):
>
> Message-ID: <53b5ab1e.Y9bKd3t4DteE6Pzc%fengguang.wu@intel.com>
> [wireless-next:master 163/164]
> drivers/net/wireless/b43/phy_n.c:5671:55: sparse: cast truncates bits
> from constant value (ffff7fff becomes 7fff)
>
> Message-ID: <53c97150.9C2t3ebOTkndUZD5%fengguang.wu@intel.com>
> [wireless-next:master 70/75] drivers/net/wireless/b43/phy_n.c:6077:35:
> sparse: cast truncates bits from constant value (ffff3fff becomes
> 3fff)
>
> In both of them I pointed that this is an expected behavior. No other
> solution was proposed.
>
> Can this test be fixed or disabled?
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [wireless-next:master 70/102] drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff)
2014-09-16 2:17 ` [wireless-next:master 70/102] drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff) Fengguang Wu
@ 2014-09-16 7:20 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-09-16 7:20 UTC (permalink / raw)
To: Fengguang Wu
Cc: Rafał Miłecki, John W. Linville, kbuild-all,
Christopher Li, Linux-Sparse
On Tue, Sep 16, 2014 at 10:17:18AM +0800, Fengguang Wu wrote:
> I could disable this warning in my reports, but CC sparse authors
> first to check if there are more elegant solutions.
int main(void)
{
printf("%x\n", (unsigned short)~(0xc00)); // <-- ok
printf("%x\n", (unsigned short)~(0xc000)); // <-- complains
return 0;
}
test.c:10:40: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)
The reason the first one is ok is because we don't complain if the
truncated bits are purely sign bits. I feel like it should apply to the
second statement as well. If we're only masking out 0xffff then don't
complain.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-16 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <541742fe.FxHiltLcSOUDGDDj%fengguang.wu@intel.com>
[not found] ` <CACna6ryGg4NY2ecDjCKckXk8QXSJWVpbWWtdya9JRB618G92wQ@mail.gmail.com>
2014-09-16 2:17 ` [wireless-next:master 70/102] drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff) Fengguang Wu
2014-09-16 7:20 ` Dan Carpenter
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).