lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202112161000.15tF7PTx-lkp@intel.com>
Date:   Fri, 17 Dec 2021 10:20:18 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Qiuxu Zhuo <qiuxu.zhuo@...el.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Tony Luck <tony.luck@...el.com>
Subject: drivers/edac/i10nm_base.c:256 i10nm_get_hbm_munits() warn: 'mbase'
 not released on lines: 249.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2b14864acbaaf03d9c01982e243a84632524c3ac
commit: c945088384d00e6eb61535cc4ba25bc062090909 EDAC/i10nm: Add support for high bandwidth memory
config: x86_64-randconfig-m001-20211215 (https://download.01.org/0day-ci/archive/20211216/202112161000.15tF7PTx-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/edac/i10nm_base.c:256 i10nm_get_hbm_munits() warn: 'mbase' not released on lines: 249.

vim +/mbase +256 drivers/edac/i10nm_base.c

c945088384d00e Qiuxu Zhuo 2021-06-11  187  static int i10nm_get_hbm_munits(void)
c945088384d00e Qiuxu Zhuo 2021-06-11  188  {
c945088384d00e Qiuxu Zhuo 2021-06-11  189  	struct pci_dev *mdev;
c945088384d00e Qiuxu Zhuo 2021-06-11  190  	void __iomem *mbase;
c945088384d00e Qiuxu Zhuo 2021-06-11  191  	u32 reg, off, mcmtr;
c945088384d00e Qiuxu Zhuo 2021-06-11  192  	struct skx_dev *d;
c945088384d00e Qiuxu Zhuo 2021-06-11  193  	int i, lmc;
c945088384d00e Qiuxu Zhuo 2021-06-11  194  	u64 base;
c945088384d00e Qiuxu Zhuo 2021-06-11  195  
c945088384d00e Qiuxu Zhuo 2021-06-11  196  	list_for_each_entry(d, i10nm_edac_list, list) {
c945088384d00e Qiuxu Zhuo 2021-06-11  197  		d->pcu_cr3 = pci_get_dev_wrapper(d->seg, d->bus[1], 30, 3);
c945088384d00e Qiuxu Zhuo 2021-06-11  198  		if (!d->pcu_cr3)
c945088384d00e Qiuxu Zhuo 2021-06-11  199  			return -ENODEV;
c945088384d00e Qiuxu Zhuo 2021-06-11  200  
c945088384d00e Qiuxu Zhuo 2021-06-11  201  		if (!i10nm_check_hbm_imc(d)) {
c945088384d00e Qiuxu Zhuo 2021-06-11  202  			i10nm_printk(KERN_DEBUG, "No hbm memory\n");
c945088384d00e Qiuxu Zhuo 2021-06-11  203  			return -ENODEV;
c945088384d00e Qiuxu Zhuo 2021-06-11  204  		}
c945088384d00e Qiuxu Zhuo 2021-06-11  205  
c945088384d00e Qiuxu Zhuo 2021-06-11  206  		if (I10NM_GET_SCK_BAR(d, reg)) {
c945088384d00e Qiuxu Zhuo 2021-06-11  207  			i10nm_printk(KERN_ERR, "Failed to get socket bar\n");
c945088384d00e Qiuxu Zhuo 2021-06-11  208  			return -ENODEV;
c945088384d00e Qiuxu Zhuo 2021-06-11  209  		}
c945088384d00e Qiuxu Zhuo 2021-06-11  210  		base = I10NM_GET_SCK_MMIO_BASE(reg);
c945088384d00e Qiuxu Zhuo 2021-06-11  211  
c945088384d00e Qiuxu Zhuo 2021-06-11  212  		if (I10NM_GET_HBM_IMC_BAR(d, reg)) {
c945088384d00e Qiuxu Zhuo 2021-06-11  213  			i10nm_printk(KERN_ERR, "Failed to get hbm mc bar\n");
c945088384d00e Qiuxu Zhuo 2021-06-11  214  			return -ENODEV;
c945088384d00e Qiuxu Zhuo 2021-06-11  215  		}
c945088384d00e Qiuxu Zhuo 2021-06-11  216  		base += I10NM_GET_HBM_IMC_MMIO_OFFSET(reg);
c945088384d00e Qiuxu Zhuo 2021-06-11  217  
c945088384d00e Qiuxu Zhuo 2021-06-11  218  		lmc = I10NM_NUM_DDR_IMC;
c945088384d00e Qiuxu Zhuo 2021-06-11  219  
c945088384d00e Qiuxu Zhuo 2021-06-11  220  		for (i = 0; i < I10NM_NUM_HBM_IMC; i++) {
c945088384d00e Qiuxu Zhuo 2021-06-11  221  			mdev = pci_get_dev_wrapper(d->seg, d->bus[0],
c945088384d00e Qiuxu Zhuo 2021-06-11  222  						   12 + i / 4, 1 + i % 4);
c945088384d00e Qiuxu Zhuo 2021-06-11  223  			if (i == 0 && !mdev) {
c945088384d00e Qiuxu Zhuo 2021-06-11  224  				i10nm_printk(KERN_ERR, "No hbm mc found\n");
c945088384d00e Qiuxu Zhuo 2021-06-11  225  				return -ENODEV;
c945088384d00e Qiuxu Zhuo 2021-06-11  226  			}
c945088384d00e Qiuxu Zhuo 2021-06-11  227  			if (!mdev)
c945088384d00e Qiuxu Zhuo 2021-06-11  228  				continue;
c945088384d00e Qiuxu Zhuo 2021-06-11  229  
c945088384d00e Qiuxu Zhuo 2021-06-11  230  			d->imc[lmc].mdev = mdev;
c945088384d00e Qiuxu Zhuo 2021-06-11  231  			off = i * I10NM_HBM_IMC_MMIO_SIZE;
c945088384d00e Qiuxu Zhuo 2021-06-11  232  
c945088384d00e Qiuxu Zhuo 2021-06-11  233  			edac_dbg(2, "hbm mc%d mmio base 0x%llx size 0x%x\n",
c945088384d00e Qiuxu Zhuo 2021-06-11  234  				 lmc, base + off, I10NM_HBM_IMC_MMIO_SIZE);
c945088384d00e Qiuxu Zhuo 2021-06-11  235  
c945088384d00e Qiuxu Zhuo 2021-06-11  236  			mbase = ioremap(base + off, I10NM_HBM_IMC_MMIO_SIZE);
                                                                ^^^^^^^^^^^^^^^^

c945088384d00e Qiuxu Zhuo 2021-06-11  237  			if (!mbase) {
c945088384d00e Qiuxu Zhuo 2021-06-11  238  				i10nm_printk(KERN_ERR, "Failed to ioremap for hbm mc 0x%llx\n",
c945088384d00e Qiuxu Zhuo 2021-06-11  239  					     base + off);
c945088384d00e Qiuxu Zhuo 2021-06-11  240  				return -ENOMEM;
c945088384d00e Qiuxu Zhuo 2021-06-11  241  			}
c945088384d00e Qiuxu Zhuo 2021-06-11  242  
c945088384d00e Qiuxu Zhuo 2021-06-11  243  			d->imc[lmc].mbase = mbase;
c945088384d00e Qiuxu Zhuo 2021-06-11  244  			d->imc[lmc].hbm_mc = true;
c945088384d00e Qiuxu Zhuo 2021-06-11  245  
c945088384d00e Qiuxu Zhuo 2021-06-11  246  			mcmtr = I10NM_GET_MCMTR(&d->imc[lmc], 0);
c945088384d00e Qiuxu Zhuo 2021-06-11  247  			if (!I10NM_IS_HBM_IMC(mcmtr)) {
c945088384d00e Qiuxu Zhuo 2021-06-11  248  				i10nm_printk(KERN_ERR, "This isn't an hbm mc!\n");
c945088384d00e Qiuxu Zhuo 2021-06-11  249  				return -ENODEV;

No clean up before the return.

c945088384d00e Qiuxu Zhuo 2021-06-11  250  			}
c945088384d00e Qiuxu Zhuo 2021-06-11  251  
c945088384d00e Qiuxu Zhuo 2021-06-11  252  			lmc++;
c945088384d00e Qiuxu Zhuo 2021-06-11  253  		}
c945088384d00e Qiuxu Zhuo 2021-06-11  254  	}
c945088384d00e Qiuxu Zhuo 2021-06-11  255  
c945088384d00e Qiuxu Zhuo 2021-06-11 @256  	return 0;
c945088384d00e Qiuxu Zhuo 2021-06-11  257  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ