From: Dan Carpenter <dan.carpenter@oracle.com>
To: Hartley Sweeten <HartleyS@visionengravers.com>
Cc: "Marcos A. Di Pietro" <marcosadp@gmail.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
linux-sparse@vger.kernel.org
Subject: Re: [PATCH] Staging/comedi: Fixes static analysis warning raised by sparse
Date: Thu, 12 Jun 2014 00:24:25 +0300 [thread overview]
Message-ID: <20140611212425.GW5015@mwanda> (raw)
In-Reply-To: <DC148C5AA1CEBA4E87973D432B1C2D8825E9CBD6@P3PWEX4MB008.ex4.secureserver.net>
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
Let's forward this to the Sparse mailing list.
We're seeing a Sparse false positive testing
drivers/staging/comedi/drivers/ni_pcimio.c.
CHECK drivers/staging/comedi/drivers/ni_pcimio.c
drivers/staging/comedi/drivers/ni_stc.h:720:26: warning: shift too big (4294967295) for type int
drivers/staging/comedi/drivers/ni_stc.h:720:26: warning: shift too big (4294967295) for type int
drivers/staging/comedi/drivers/ni_stc.h:720:26: warning: shift too big (4294967295) for type int
drivers/staging/comedi/drivers/ni_stc.h:720:26: warning: shift too big (4294967295) for type int
I have created some test code to demonstrate the problem (attached).
The check_shift_count() warning is only supposed to be printed for
number literals but because of the way inline functions are expanded it
still complains even though channel is a variable.
regards,
dan carpenter
[-- Attachment #2: test_shift.c --]
[-- Type: text/x-csrc, Size: 355 bytes --]
#include <stdio.h>
#include <limits.h>
#include <string.h>
static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
{
if (channel < 4)
return 1 << channel;
return 0;
}
static inline void filter(int channel)
{
if (channel < 0)
return;
ni_stc_dma_channel_select_bitfield(channel);
}
int main(void)
{
filter(-1);
return 0;
}
next parent reply other threads:[~2014-06-11 21:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53965E53.5080504@gmail.com>
[not found] ` <20140610054741.GE5500@mwanda>
[not found] ` <DC148C5AA1CEBA4E87973D432B1C2D8825E9AE6A@P3PWEX4MB008.ex4.secureserver.net>
[not found] ` <20140611065612.GQ5015@mwanda>
[not found] ` <DC148C5AA1CEBA4E87973D432B1C2D8825E9CBD6@P3PWEX4MB008.ex4.secureserver.net>
2014-06-11 21:24 ` Dan Carpenter [this message]
2014-06-11 21:45 ` [PATCH] Staging/comedi: Fixes static analysis warning raised by sparse josh
2014-06-15 19:32 ` Sam Ravnborg
2014-06-16 7:40 ` Dan Carpenter
2014-06-16 8:06 ` Sam Ravnborg
2014-06-28 18:07 ` Christopher Li
2014-06-28 19:20 ` Josh Triplett
2014-06-29 3:09 ` Christopher Li
2014-06-30 17:49 ` Christopher Li
2014-06-30 18:32 ` Christopher Li
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=20140611212425.GW5015@mwanda \
--to=dan.carpenter@oracle.com \
--cc=HartleyS@visionengravers.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-sparse@vger.kernel.org \
--cc=marcosadp@gmail.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.