Re: [PATCH v8 4/4] powerpc: Book3S 64-bit "heavyweight" KASAN support

From: kernel test robot
Date: Mon Jul 06 2020 - 04:42:02 EST


Hi Daniel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on linux/master linus/master v5.8-rc4 next-20200703]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Daniel-Axtens/KASAN-for-powerpc64-radix/20200702-105552
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc64-randconfig-s031-20200706 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-14-g8fce3d7a-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

drivers/char/tpm/tpm_ibmvtpm.c:130:9: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/char/tpm/tpm_ibmvtpm.c:131:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *s @@ got void [noderef] __iomem *rtce_buf @@
>> drivers/char/tpm/tpm_ibmvtpm.c:131:9: sparse: expected void *s
drivers/char/tpm/tpm_ibmvtpm.c:131:9: sparse: got void [noderef] __iomem *rtce_buf
drivers/char/tpm/tpm_ibmvtpm.c:234:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/char/tpm/tpm_ibmvtpm.c:369:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *rtce_buf @@
drivers/char/tpm/tpm_ibmvtpm.c:369:30: sparse: expected void const *
drivers/char/tpm/tpm_ibmvtpm.c:369:30: sparse: got void [noderef] __iomem *rtce_buf
drivers/char/tpm/tpm_ibmvtpm.c:530:43: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *rtce_buf @@ got void * @@
drivers/char/tpm/tpm_ibmvtpm.c:530:43: sparse: expected void [noderef] __iomem *rtce_buf
drivers/char/tpm/tpm_ibmvtpm.c:530:43: sparse: got void *
drivers/char/tpm/tpm_ibmvtpm.c:537:52: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *ptr @@ got void [noderef] __iomem *rtce_buf @@
drivers/char/tpm/tpm_ibmvtpm.c:537:52: sparse: expected void *ptr
drivers/char/tpm/tpm_ibmvtpm.c:537:52: sparse: got void [noderef] __iomem *rtce_buf
drivers/char/tpm/tpm_ibmvtpm.c:543:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *rtce_buf @@
drivers/char/tpm/tpm_ibmvtpm.c:543:46: sparse: expected void const *
drivers/char/tpm/tpm_ibmvtpm.c:543:46: sparse: got void [noderef] __iomem *rtce_buf
--
drivers/tty/vt/vt.c:233:5: sparse: sparse: symbol 'console_blank_hook' was not declared. Should it be static?
drivers/tty/vt/vt.c:2901:19: sparse: sparse: symbol 'console_driver' was not declared. Should it be static?
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
>> arch/powerpc/include/asm/vga.h:40:21: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
>> arch/powerpc/include/asm/vga.h:40:21: sparse: expected unsigned short [usertype]
arch/powerpc/include/asm/vga.h:40:21: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:34:16: sparse: sparse: cast to restricted __le16
arch/powerpc/include/asm/vga.h:29:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
arch/powerpc/include/asm/vga.h:29:15: sparse: expected unsigned short volatile [usertype]
arch/powerpc/include/asm/vga.h:29:15: sparse: got restricted __le16 [usertype]

vim +131 drivers/char/tpm/tpm_ibmvtpm.c

132f7629474424 Ashley Lai 2012-08-22 94
132f7629474424 Ashley Lai 2012-08-22 95 /**
132f7629474424 Ashley Lai 2012-08-22 96 * tpm_ibmvtpm_recv - Receive data after send
93c12f293f8798 Winkler, Tomas 2016-11-23 97 *
132f7629474424 Ashley Lai 2012-08-22 98 * @chip: tpm chip struct
132f7629474424 Ashley Lai 2012-08-22 99 * @buf: buffer to read
93c12f293f8798 Winkler, Tomas 2016-11-23 100 * @count: size of buffer
132f7629474424 Ashley Lai 2012-08-22 101 *
93c12f293f8798 Winkler, Tomas 2016-11-23 102 * Return:
132f7629474424 Ashley Lai 2012-08-22 103 * Number of bytes read
132f7629474424 Ashley Lai 2012-08-22 104 */
132f7629474424 Ashley Lai 2012-08-22 105 static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
132f7629474424 Ashley Lai 2012-08-22 106 {
9e0d39d8a6a0a8 Christophe Ricard 2016-03-31 107 struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
132f7629474424 Ashley Lai 2012-08-22 108 u16 len;
b5666502700855 Ashley Lai 2012-09-12 109 int sig;
132f7629474424 Ashley Lai 2012-08-22 110
132f7629474424 Ashley Lai 2012-08-22 111 if (!ibmvtpm->rtce_buf) {
132f7629474424 Ashley Lai 2012-08-22 112 dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
132f7629474424 Ashley Lai 2012-08-22 113 return 0;
132f7629474424 Ashley Lai 2012-08-22 114 }
132f7629474424 Ashley Lai 2012-08-22 115
6674ff145eef1f Stefan Berger 2015-12-09 116 sig = wait_event_interruptible(ibmvtpm->wq, !ibmvtpm->tpm_processing_cmd);
b5666502700855 Ashley Lai 2012-09-12 117 if (sig)
b5666502700855 Ashley Lai 2012-09-12 118 return -EINTR;
b5666502700855 Ashley Lai 2012-09-12 119
b5666502700855 Ashley Lai 2012-09-12 120 len = ibmvtpm->res_len;
132f7629474424 Ashley Lai 2012-08-22 121
b5666502700855 Ashley Lai 2012-09-12 122 if (count < len) {
132f7629474424 Ashley Lai 2012-08-22 123 dev_err(ibmvtpm->dev,
37ab03414829e5 Jason Gunthorpe 2013-09-14 124 "Invalid size in recv: count=%zd, crq_size=%d\n",
b5666502700855 Ashley Lai 2012-09-12 125 count, len);
132f7629474424 Ashley Lai 2012-08-22 126 return -EIO;
132f7629474424 Ashley Lai 2012-08-22 127 }
132f7629474424 Ashley Lai 2012-08-22 128
132f7629474424 Ashley Lai 2012-08-22 129 spin_lock(&ibmvtpm->rtce_lock);
b5666502700855 Ashley Lai 2012-09-12 130 memcpy((void *)buf, (void *)ibmvtpm->rtce_buf, len);
b5666502700855 Ashley Lai 2012-09-12 @131 memset(ibmvtpm->rtce_buf, 0, len);
b5666502700855 Ashley Lai 2012-09-12 132 ibmvtpm->res_len = 0;
132f7629474424 Ashley Lai 2012-08-22 133 spin_unlock(&ibmvtpm->rtce_lock);
132f7629474424 Ashley Lai 2012-08-22 134 return len;
132f7629474424 Ashley Lai 2012-08-22 135 }
132f7629474424 Ashley Lai 2012-08-22 136

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip