Re: drivers/scsi/pmcraid.c:3350:48: sparse: incorrect type in argument 2 (different address spaces)

From: Arnd Bergmann
Date: Tue May 09 2017 - 03:50:07 EST


On Tue, May 9, 2017 at 2:32 AM, kbuild test robot
<fengguang.wu@xxxxxxxxx> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 2d3e4866dea96b0506395b47bfefb234f2088dac
> commit: beba3a20bf90ce1b93e24592c3ebf0d0bb581bbe x86: switch to RAW_COPY_USER
> date: 6 weeks ago
> reproduce:
> # apt-get install sparse
> git checkout beba3a20bf90ce1b93e24592c3ebf0d0bb581bbe
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
> drivers/scsi/pmcraid.c:163:22: sparse: cast from restricted __le16
> drivers/scsi/pmcraid.c:163:22: sparse: cast to restricted __be16
> drivers/scsi/pmcraid.c:163:22: sparse: cast from restricted __le16
> drivers/scsi/pmcraid.c:163:22: sparse: cast to restricted __be16
> drivers/scsi/pmcraid.c:163:22: sparse: cast from restricted __le16
> drivers/scsi/pmcraid.c:178:57: sparse: restricted __le16 degrades to integer
> drivers/scsi/pmcraid.c:333:41: sparse: invalid assignment: &=
> drivers/scsi/pmcraid.c:333:41: left side has type restricted __le64
> drivers/scsi/pmcraid.c:333:41: right side has type unsigned long long
> drivers/scsi/pmcraid.c:348:29: sparse: Using plain integer as NULL pointer
> drivers/scsi/pmcraid.c:901:19: sparse: cast to restricted __le32
> drivers/scsi/pmcraid.c:901:19: sparse: cast from restricted __le64
> drivers/scsi/pmcraid.c:5727:30: sparse: incorrect type in initializer (different base types)
> drivers/scsi/pmcraid.c:5727:30: expected int [signed] cfg_table_size
> drivers/scsi/pmcraid.c:5727:30: got restricted __be32 [usertype] <noident>
> drivers/scsi/pmcraid.c:5729:13: sparse: cast to restricted __be16
> drivers/scsi/pmcraid.c:5729:13: sparse: cast from restricted __le16
> drivers/scsi/pmcraid.c:5729:13: sparse: cast to restricted __be16

I'm not entirely sure why these all show up now, but my guess is that
the friendly robot got confused by my patches that I sent a few weeks
ago to fix all the sparse warnings in this driver, leading it to tag the
warnings as regressions even though they are all old.

Arnd