RE: [PATCH] Staging/comedi: Fixes static analysis warning raised by sparse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday, June 10, 2014 11:56 PM, Dan Carpenter wrote:
> On Tue, Jun 10, 2014 at 10:36:13PM +0000, Hartley Sweeten wrote:
>> On Monday, June 09, 2014 10:48 PM, Dan Carpenter wrote:
>>> On Mon, Jun 09, 2014 at 09:24:35PM -0400, Marcos A. Di Pietro wrote:
>>>> Fixes warning static analysis warning raised by sparse in drivers/staging/comedi/drivers/ni_stc.h
>>>> 
>>>> warning: shift too big (4294967295) for type int
>>>
>>> This warning seems wrong.  I don't even understand how it thinks the
>>> shift is too big. The patch doesn't make sense and it introduces a bug.
>> 
>> The warning is a bit annoying and I also haven't figured out why sparse
>> thinks the shift is too big.
>
> I can't figure out how to reproduce this Sparse warning.  I compiled
> drivers/staging/comedi/drivers/ni_mio_cs.c and it doesn't have it.
> I double checked by doing a
> `make drivers/staging/comedi/drivers/ni_mio_cs.i` that the
> ni_stc_dma_channel_select_bitfield is not ifdeffed out.
>
> Which version of Sparse are you using?  Really the correct thing is to
> fix Sparse.

I don't think sparse has a way to query the version so I'm not sure. But, I
just pulled the latest from git://git.kernel.org/pub/scm/devel/sparse/sparse.git
and built that so now I _should_ have the latest version regardless.

With today's next-20140611 branch:
$ make C=2 M=drivers/staging/comedi
...
  CHECK   drivers/staging/comedi/comedi_compat32.c
drivers/staging/comedi/comedi_compat32.c:201:16: warning: cast removes address space of expression
drivers/staging/comedi/comedi_compat32.c:201:16: warning: cast removes address space of expression
drivers/staging/comedi/comedi_compat32.c:201:16: warning: cast removes address space of expression
drivers/staging/comedi/comedi_compat32.c:201:16: warning: cast removes address space of expression
...
  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

BTW, drivers/staging/comedi/drivers/ni_mio_cs.c does not use the
code in ni_stc.h or ni_mio_common.c that would cause the warnings.
The functions that use ni_stc_dma_channel_select_bitfield() are only
enabled when PCIDMA is defined, which is only done in ni_pcimio.c.

Regards,
Hartley



_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux