Re: [PATCH 2/2] pci: fix memleak when calling pci_iomap/unmap()
From: kernel test robot
Date: Fri Aug 28 2020 - 07:26:20 EST
Hi Yang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on linux/master linus/master v5.9-rc2 next-20200828]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yang-Yingliang/fix-memleak-when-using-pci_iounmap/20200828-143645
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: powerpc64-randconfig-s032-20200828 (attached as .config)
compiler: powerpc-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-191-g10164920-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/scsi/mvumi.c:81:52: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void * @@
>> drivers/scsi/mvumi.c:81:52: sparse: expected void [noderef] __iomem *addr
drivers/scsi/mvumi.c:81:52: sparse: got void *
drivers/scsi/mvumi.c:90:39: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
drivers/scsi/mvumi.c:90:39: sparse: expected void *
drivers/scsi/mvumi.c:90:39: sparse: got void [noderef] __iomem *
drivers/scsi/mvumi.c:210:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] baseaddr_l @@ got restricted __le32 [usertype] @@
drivers/scsi/mvumi.c:210:34: sparse: expected unsigned int [usertype] baseaddr_l
drivers/scsi/mvumi.c:210:34: sparse: got restricted __le32 [usertype]
drivers/scsi/mvumi.c:211:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] baseaddr_h @@ got restricted __le32 [usertype] @@
drivers/scsi/mvumi.c:211:34: sparse: expected unsigned int [usertype] baseaddr_h
drivers/scsi/mvumi.c:211:34: sparse: got restricted __le32 [usertype]
drivers/scsi/mvumi.c:213:17: sparse: sparse: invalid assignment: |=
drivers/scsi/mvumi.c:213:17: sparse: left side has type unsigned int
drivers/scsi/mvumi.c:213:17: sparse: right side has type restricted __le32
drivers/scsi/mvumi.c:213:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] size @@ got restricted __le32 [usertype] @@
drivers/scsi/mvumi.c:213:17: sparse: expected unsigned int [usertype] size
drivers/scsi/mvumi.c:213:17: sparse: got restricted __le32 [usertype]
drivers/scsi/mvumi.c:242:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] baseaddr_l @@ got restricted __le32 [usertype] @@
drivers/scsi/mvumi.c:242:26: sparse: expected unsigned int [usertype] baseaddr_l
drivers/scsi/mvumi.c:242:26: sparse: got restricted __le32 [usertype]
drivers/scsi/mvumi.c:243:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] baseaddr_h @@ got restricted __le32 [usertype] @@
drivers/scsi/mvumi.c:243:26: sparse: expected unsigned int [usertype] baseaddr_h
drivers/scsi/mvumi.c:243:26: sparse: got restricted __le32 [usertype]
drivers/scsi/mvumi.c:245:9: sparse: sparse: invalid assignment: |=
drivers/scsi/mvumi.c:245:9: sparse: left side has type unsigned int
drivers/scsi/mvumi.c:245:9: sparse: right side has type restricted __le32
drivers/scsi/mvumi.c:245:9: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] size @@ got restricted __le32 [usertype] @@
drivers/scsi/mvumi.c:245:9: sparse: expected unsigned int [usertype] size
drivers/scsi/mvumi.c:245:9: sparse: got restricted __le32 [usertype]
drivers/scsi/mvumi.c:407:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *inb_read_pointer @@
drivers/scsi/mvumi.c:407:40: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:407:40: sparse: got void *inb_read_pointer
drivers/scsi/mvumi.c:429:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *ib_shadow @@
drivers/scsi/mvumi.c:429:30: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:429:30: sparse: got void *ib_shadow
drivers/scsi/mvumi.c:458:31: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *ib_shadow @@
drivers/scsi/mvumi.c:458:31: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:458:31: sparse: got void *ib_shadow
drivers/scsi/mvumi.c:459:48: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *inb_write_pointer @@
drivers/scsi/mvumi.c:459:48: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:459:48: sparse: got void *inb_write_pointer
drivers/scsi/mvumi.c:496:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *outb_copy_pointer @@
drivers/scsi/mvumi.c:496:41: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:496:41: sparse: got void *outb_copy_pointer
drivers/scsi/mvumi.c:497:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *ob_shadow @@
drivers/scsi/mvumi.c:497:48: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:497:48: sparse: got void *ob_shadow
drivers/scsi/mvumi.c:516:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *outb_read_pointer @@
drivers/scsi/mvumi.c:516:33: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:516:33: sparse: got void *outb_read_pointer
drivers/scsi/mvumi.c:517:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *outb_copy_pointer @@
drivers/scsi/mvumi.c:517:33: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:517:33: sparse: got void *outb_copy_pointer
drivers/scsi/mvumi.c:578:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *outb_read_pointer @@
drivers/scsi/mvumi.c:578:42: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:578:42: sparse: got void *outb_read_pointer
drivers/scsi/mvumi.c:585:26: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *enpointa_mask_reg @@
drivers/scsi/mvumi.c:585:26: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:585:26: sparse: got void *enpointa_mask_reg
drivers/scsi/mvumi.c:586:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *arm_to_pciea_msg1 @@
drivers/scsi/mvumi.c:586:26: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:586:26: sparse: got void *arm_to_pciea_msg1
drivers/scsi/mvumi.c:589:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *pciea_to_arm_drbl_reg @@
drivers/scsi/mvumi.c:589:40: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:589:40: sparse: got void *pciea_to_arm_drbl_reg
drivers/scsi/mvumi.c:1281:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *arm_to_pciea_drbl_reg @@
drivers/scsi/mvumi.c:1281:28: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:1281:28: sparse: got void *arm_to_pciea_drbl_reg
drivers/scsi/mvumi.c:1282:28: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *arm_to_pciea_drbl_reg @@
drivers/scsi/mvumi.c:1282:28: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:1282:28: sparse: got void *arm_to_pciea_drbl_reg
drivers/scsi/mvumi.c:1284:48: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *arm_to_pciea_mask_reg @@
drivers/scsi/mvumi.c:1284:48: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:1284:48: sparse: got void *arm_to_pciea_mask_reg
drivers/scsi/mvumi.c:1285:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *enpointa_mask_reg @@
drivers/scsi/mvumi.c:1285:28: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:1285:28: sparse: got void *enpointa_mask_reg
drivers/scsi/mvumi.c:1286:28: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *enpointa_mask_reg @@
drivers/scsi/mvumi.c:1286:28: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:1286:28: sparse: got void *enpointa_mask_reg
drivers/scsi/mvumi.c:612:26: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *enpointa_mask_reg @@
drivers/scsi/mvumi.c:612:26: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:612:26: sparse: got void *enpointa_mask_reg
drivers/scsi/mvumi.c:613:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *arm_to_pciea_msg1 @@
drivers/scsi/mvumi.c:613:28: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:613:28: sparse: got void *arm_to_pciea_msg1
drivers/scsi/mvumi.c:615:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *pciea_to_arm_drbl_reg @@
drivers/scsi/mvumi.c:615:46: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:615:46: sparse: got void *pciea_to_arm_drbl_reg
drivers/scsi/mvumi.c:624:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got void *arm_to_pciea_msg1 @@
drivers/scsi/mvumi.c:624:36: sparse: expected void const [noderef] __iomem *
drivers/scsi/mvumi.c:624:36: sparse: got void *arm_to_pciea_msg1
drivers/scsi/mvumi.c:670:32: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *reset_enable @@
drivers/scsi/mvumi.c:670:32: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:670:32: sparse: got void *reset_enable
drivers/scsi/mvumi.c:671:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *reset_request @@
drivers/scsi/mvumi.c:671:34: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:671:34: sparse: got void *reset_request
drivers/scsi/mvumi.c:673:35: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got void *reset_enable @@
drivers/scsi/mvumi.c:673:35: sparse: expected void [noderef] __iomem *
drivers/scsi/mvumi.c:673:35: sparse: got void *reset_enable
# https://github.com/0day-ci/linux/commit/6a62687154945b449554222ffe875acae4cd1cdb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Yingliang/fix-memleak-when-using-pci_iounmap/20200828-143645
git checkout 6a62687154945b449554222ffe875acae4cd1cdb
vim +81 drivers/scsi/mvumi.c
f0c568a478f035 Jianyun Li 2011-05-11 73
f0c568a478f035 Jianyun Li 2011-05-11 74 static void mvumi_unmap_pci_addr(struct pci_dev *dev, void **addr_array)
f0c568a478f035 Jianyun Li 2011-05-11 75 {
f0c568a478f035 Jianyun Li 2011-05-11 76 int i;
f0c568a478f035 Jianyun Li 2011-05-11 77
f0c568a478f035 Jianyun Li 2011-05-11 78 for (i = 0; i < MAX_BASE_ADDRESS; i++)
f0c568a478f035 Jianyun Li 2011-05-11 79 if ((pci_resource_flags(dev, i) & IORESOURCE_MEM) &&
f0c568a478f035 Jianyun Li 2011-05-11 80 addr_array[i])
f0c568a478f035 Jianyun Li 2011-05-11 @81 pci_iounmap(dev, addr_array[i]);
f0c568a478f035 Jianyun Li 2011-05-11 82 }
f0c568a478f035 Jianyun Li 2011-05-11 83
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip