Re: [PATCH 1/1] scsi: mvsas:fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Xidong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v4.16 next-20180403]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Xidong-Wang/scsi-mvsas-fix-memory-leak/20180404-182132
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-x016-201813 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from drivers/scsi/mvsas/mv_sas.h:29,
                    from drivers/scsi/mvsas/mv_init.c:27:
   drivers/scsi/mvsas/mv_init.c: In function 'mvs_pci_alloc':
   include/linux/compiler.h:58:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> drivers/scsi/mvsas/mv_init.c:373:2: note: in expansion of macro 'if'
     if (!mvi)
     ^~
   drivers/scsi/mvsas/mv_init.c:375:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
      return NULL;
      ^~~~~~

vim +/if +373 drivers/scsi/mvsas/mv_init.c

20b09c29 Andy Yan           2009-05-08  362  
6f039790 Greg Kroah-Hartman 2012-12-21  363  static struct mvs_info *mvs_pci_alloc(struct pci_dev *pdev,
20b09c29 Andy Yan           2009-05-08  364  				const struct pci_device_id *ent,
20b09c29 Andy Yan           2009-05-08  365  				struct Scsi_Host *shost, unsigned int id)
20b09c29 Andy Yan           2009-05-08  366  {
84fbd0ce Xiangliang Yu      2011-05-24  367  	struct mvs_info *mvi = NULL;
20b09c29 Andy Yan           2009-05-08  368  	struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
20b09c29 Andy Yan           2009-05-08  369  
b89e8f53 Xiangliang Yu      2011-05-24  370  	mvi = kzalloc(sizeof(*mvi) +
b89e8f53 Xiangliang Yu      2011-05-24  371  		(1L << mvs_chips[ent->driver_data].slot_width) *
b89e8f53 Xiangliang Yu      2011-05-24  372  		sizeof(struct mvs_slot_info), GFP_KERNEL);
20b09c29 Andy Yan           2009-05-08 @373  	if (!mvi)
549079d1 Xidong Wang        2018-04-04  374  		scsi_host_put(shost);
20b09c29 Andy Yan           2009-05-08  375  		return NULL;
dd4969a8 Jeff Garzik        2009-05-08  376  
20b09c29 Andy Yan           2009-05-08  377  	mvi->pdev = pdev;
20b09c29 Andy Yan           2009-05-08  378  	mvi->dev = &pdev->dev;
20b09c29 Andy Yan           2009-05-08  379  	mvi->chip_id = ent->driver_data;
20b09c29 Andy Yan           2009-05-08  380  	mvi->chip = &mvs_chips[mvi->chip_id];
20b09c29 Andy Yan           2009-05-08  381  	INIT_LIST_HEAD(&mvi->wq_list);
20b09c29 Andy Yan           2009-05-08  382  
20b09c29 Andy Yan           2009-05-08  383  	((struct mvs_prv_info *)sha->lldd_ha)->mvi[id] = mvi;
20b09c29 Andy Yan           2009-05-08  384  	((struct mvs_prv_info *)sha->lldd_ha)->n_phy = mvi->chip->n_phy;
20b09c29 Andy Yan           2009-05-08  385  
20b09c29 Andy Yan           2009-05-08  386  	mvi->id = id;
20b09c29 Andy Yan           2009-05-08  387  	mvi->sas = sha;
20b09c29 Andy Yan           2009-05-08  388  	mvi->shost = shost;
20b09c29 Andy Yan           2009-05-08  389  
b89e8f53 Xiangliang Yu      2011-05-24  390  	mvi->tags = kzalloc(MVS_CHIP_SLOT_SZ>>3, GFP_KERNEL);
b89e8f53 Xiangliang Yu      2011-05-24  391  	if (!mvi->tags)
b89e8f53 Xiangliang Yu      2011-05-24  392  		goto err_out;
b89e8f53 Xiangliang Yu      2011-05-24  393  
20b09c29 Andy Yan           2009-05-08  394  	if (MVS_CHIP_DISP->chip_ioremap(mvi))
20b09c29 Andy Yan           2009-05-08  395  		goto err_out;
20b09c29 Andy Yan           2009-05-08  396  	if (!mvs_alloc(mvi, shost))
20b09c29 Andy Yan           2009-05-08  397  		return mvi;
dd4969a8 Jeff Garzik        2009-05-08  398  err_out:
dd4969a8 Jeff Garzik        2009-05-08  399  	mvs_free(mvi);
dd4969a8 Jeff Garzik        2009-05-08  400  	return NULL;
dd4969a8 Jeff Garzik        2009-05-08  401  }
dd4969a8 Jeff Garzik        2009-05-08  402  

:::::: The code at line 373 was first introduced by commit
:::::: 20b09c2992fefbe78f8cede7b404fb143a413c52 [SCSI] mvsas: add support for 94xx; layout change; bug fixes

:::::: TO: Andy Yan <ayan@xxxxxxxxxxx>
:::::: CC: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux