[gustavoars:testing/WFAMNAE-next20240215 1/1] arch/um/drivers/virt-pci.c:285:38: error: passing argument 2 of 'um_pci_send_cmd' from incompatible pointer type

From: kernel test robot
Date: Fri Feb 16 2024 - 12:46:45 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/WFAMNAE-next20240215
head: 7a19cfa6c1665cd2b4a34d4504e23d2ee68b87b2
commit: 7a19cfa6c1665cd2b4a34d4504e23d2ee68b87b2 [1/1] treewide: Address -Wflexible-array-member-not-at-end warnings
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240217/202402170111.jekyERfk-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240217/202402170111.jekyERfk-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402170111.jekyERfk-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from ./arch/um/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/preempt.h:5,
from ./arch/um/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from include/linux/spinlock.h:56,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from arch/um/drivers/virt-pci.c:6:
arch/um/drivers/virt-pci.c: In function 'um_pci_cfgspace_write':
>> arch/um/drivers/virt-pci.c:285:38: error: passing argument 2 of 'um_pci_send_cmd' from incompatible pointer type [-Werror=incompatible-pointer-types]
285 | WARN_ON(um_pci_send_cmd(dev, &msg.hdr, sizeof(msg), NULL, 0, NULL, 0));
| ^~~~~~~~
| |
| struct virtio_pcidev_msg_tag *
include/asm-generic/bug.h:123:32: note: in definition of macro 'WARN_ON'
123 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
arch/um/drivers/virt-pci.c:72:54: note: expected 'struct virtio_pcidev_msg *' but argument is of type 'struct virtio_pcidev_msg_tag *'
72 | struct virtio_pcidev_msg *cmd,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
cc1: some warnings being treated as errors


vim +/um_pci_send_cmd +285 arch/um/drivers/virt-pci.c

68f5d3f3b65432 Johannes Berg 2021-03-05 244
68f5d3f3b65432 Johannes Berg 2021-03-05 245 static void um_pci_cfgspace_write(void *priv, unsigned int offset, int size,
68f5d3f3b65432 Johannes Berg 2021-03-05 246 unsigned long val)
68f5d3f3b65432 Johannes Berg 2021-03-05 247 {
68f5d3f3b65432 Johannes Berg 2021-03-05 248 struct um_pci_device_reg *reg = priv;
68f5d3f3b65432 Johannes Berg 2021-03-05 249 struct um_pci_device *dev = reg->dev;
68f5d3f3b65432 Johannes Berg 2021-03-05 250 struct {
7a19cfa6c1665c Gustavo A. R. Silva 2024-02-15 251 struct virtio_pcidev_msg_tag hdr;
68f5d3f3b65432 Johannes Berg 2021-03-05 252 /* maximum size - we may only use parts of it */
68f5d3f3b65432 Johannes Berg 2021-03-05 253 u8 data[8];
68f5d3f3b65432 Johannes Berg 2021-03-05 254 } msg = {
68f5d3f3b65432 Johannes Berg 2021-03-05 255 .hdr = {
68f5d3f3b65432 Johannes Berg 2021-03-05 256 .op = VIRTIO_PCIDEV_OP_CFG_WRITE,
68f5d3f3b65432 Johannes Berg 2021-03-05 257 .size = size,
68f5d3f3b65432 Johannes Berg 2021-03-05 258 .addr = offset,
68f5d3f3b65432 Johannes Berg 2021-03-05 259 },
68f5d3f3b65432 Johannes Berg 2021-03-05 260 };
68f5d3f3b65432 Johannes Berg 2021-03-05 261
68f5d3f3b65432 Johannes Berg 2021-03-05 262 if (!dev)
68f5d3f3b65432 Johannes Berg 2021-03-05 263 return;
68f5d3f3b65432 Johannes Berg 2021-03-05 264
68f5d3f3b65432 Johannes Berg 2021-03-05 265 switch (size) {
68f5d3f3b65432 Johannes Berg 2021-03-05 266 case 1:
68f5d3f3b65432 Johannes Berg 2021-03-05 267 msg.data[0] = (u8)val;
68f5d3f3b65432 Johannes Berg 2021-03-05 268 break;
68f5d3f3b65432 Johannes Berg 2021-03-05 269 case 2:
68f5d3f3b65432 Johannes Berg 2021-03-05 270 put_unaligned_le16(val, (void *)msg.data);
68f5d3f3b65432 Johannes Berg 2021-03-05 271 break;
68f5d3f3b65432 Johannes Berg 2021-03-05 272 case 4:
68f5d3f3b65432 Johannes Berg 2021-03-05 273 put_unaligned_le32(val, (void *)msg.data);
68f5d3f3b65432 Johannes Berg 2021-03-05 274 break;
68f5d3f3b65432 Johannes Berg 2021-03-05 275 #ifdef CONFIG_64BIT
68f5d3f3b65432 Johannes Berg 2021-03-05 276 case 8:
68f5d3f3b65432 Johannes Berg 2021-03-05 277 put_unaligned_le64(val, (void *)msg.data);
68f5d3f3b65432 Johannes Berg 2021-03-05 278 break;
68f5d3f3b65432 Johannes Berg 2021-03-05 279 #endif
68f5d3f3b65432 Johannes Berg 2021-03-05 280 default:
68f5d3f3b65432 Johannes Berg 2021-03-05 281 WARN(1, "invalid config space write size %d\n", size);
68f5d3f3b65432 Johannes Berg 2021-03-05 282 return;
68f5d3f3b65432 Johannes Berg 2021-03-05 283 }
68f5d3f3b65432 Johannes Berg 2021-03-05 284
68f5d3f3b65432 Johannes Berg 2021-03-05 @285 WARN_ON(um_pci_send_cmd(dev, &msg.hdr, sizeof(msg), NULL, 0, NULL, 0));
68f5d3f3b65432 Johannes Berg 2021-03-05 286 }
68f5d3f3b65432 Johannes Berg 2021-03-05 287

:::::: The code at line 285 was first introduced by commit
:::::: 68f5d3f3b6543266b29e047cfaf9842333019b4c um: add PCI over virtio emulation driver

:::::: TO: Johannes Berg <johannes.berg@xxxxxxxxx>
:::::: CC: Richard Weinberger <richard@xxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki