mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Xidong Wang <wangxidong_97@163.com>
Cc: kbuild-all@01.org,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Jack Wang <jinpu.wang@profitbricks.com>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	Peter Senna Tschudin <peter.senna@collabora.com>,
	Hannes Reinecke <hare@suse.de>, Kees Cook <keescook@chromium.org>,
	Pan Bian <bianpan2016@163.com>,
	Xidong Wang <wangxidong_97@163.com>,
	Romain Perier <romain.perier@collabora.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] scsi: mvsas:fix memory leak
Date: Wed, 4 Apr 2018 19:39:53 +0800	[thread overview]
Message-ID: <201804041915.W4Pcgmu5%fengguang.wu@intel.com> (raw)
In-Reply-To: <1522808120-11432-1-git-send-email-wangxidong_97@163.com>

[-- Attachment #1: Type: text/plain, Size: 7974 bytes --]

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: x86_64-randconfig-x010-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=x86_64 

All warnings (new ones prefixed by >>):

   drivers/scsi//mvsas/mv_init.c: In function 'mvs_pci_alloc':
>> drivers/scsi//mvsas/mv_init.c:373:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     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;
      ^~~~~~
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:test_and_set_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
   Cyclomatic Complexity 1 include/linux/mem_encrypt.h:sme_get_me_mask
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:arch_local_save_flags
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_irqs_disabled_flags
   Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
   Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
   Cyclomatic Complexity 1 include/linux/dma-debug.h:debug_dma_free_coherent
   Cyclomatic Complexity 1 arch/x86/include/asm/dma-mapping.h:get_arch_dma_ops
   Cyclomatic Complexity 4 include/linux/dma-mapping.h:get_dma_ops
   Cyclomatic Complexity 1 include/linux/kasan.h:kasan_kmalloc
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 1 include/linux/slab.h:kmem_cache_alloc_trace
   Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_order_trace
   Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/pci.h:pci_get_drvdata
   Cyclomatic Complexity 1 include/linux/pci.h:pci_set_drvdata
   Cyclomatic Complexity 5 drivers/scsi//mvsas/mv_init.c:mvs_post_sas_ha_init
   Cyclomatic Complexity 8 drivers/scsi//mvsas/mv_init.c:mvs_store_interrupt_coalescing
   Cyclomatic Complexity 1 drivers/scsi//mvsas/mv_init.c:mvs_show_interrupt_coalescing
   Cyclomatic Complexity 1 drivers/scsi//mvsas/mv_init.c:mvs_show_driver_version
   Cyclomatic Complexity 1 arch/x86/include/asm/io.h:ioremap
   Cyclomatic Complexity 1 drivers/scsi//mvsas/mv_init.c:mvs_exit
   Cyclomatic Complexity 2 drivers/scsi//mvsas/mv_init.c:mvs_pci_alloc
   Cyclomatic Complexity 4 include/linux/dma-mapping.h:dma_free_attrs
   Cyclomatic Complexity 1 include/linux/dma-mapping.h:dma_free_coherent
   Cyclomatic Complexity 13 drivers/scsi//mvsas/mv_init.c:mvs_free
   Cyclomatic Complexity 2 drivers/scsi//mvsas/mv_init.c:mvs_pci_remove
   Cyclomatic Complexity 3 drivers/scsi//mvsas/mv_init.c:mvs_tasklet
   Cyclomatic Complexity 2 include/linux/interrupt.h:tasklet_schedule
   Cyclomatic Complexity 3 drivers/scsi//mvsas/mv_init.c:mvs_interrupt
   Cyclomatic Complexity 4 include/linux/dma-mapping.h:dma_supported
   Cyclomatic Complexity 3 include/linux/dma-mapping.h:dma_check_mask
   Cyclomatic Complexity 3 include/linux/dma-mapping.h:dma_set_mask
   Cyclomatic Complexity 1 include/linux/pci-dma-compat.h:pci_set_dma_mask
   Cyclomatic Complexity 2 include/linux/dma-mapping.h:dma_set_coherent_mask
   Cyclomatic Complexity 1 include/linux/pci-dma-compat.h:pci_set_consistent_dma_mask
   Cyclomatic Complexity 6 drivers/scsi//mvsas/mv_init.c:pci_go_64
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc_array
   Cyclomatic Complexity 1 include/linux/slab.h:kcalloc
   Cyclomatic Complexity 3 drivers/scsi//mvsas/mv_init.c:mvs_prep_sas_ha_init
   Cyclomatic Complexity 2 drivers/scsi//mvsas/mv_init.c:mvs_init_sas_add
   Cyclomatic Complexity 1 include/scsi/scsi_host.h:scsi_add_host
   Cyclomatic Complexity 1 include/linux/interrupt.h:request_irq
   Cyclomatic Complexity 13 drivers/scsi//mvsas/mv_init.c:mvs_pci_init
   Cyclomatic Complexity 3 drivers/scsi//mvsas/mv_init.c:mvs_init
   Cyclomatic Complexity 13 drivers/scsi//mvsas/mv_init.c:mvs_ioremap
   Cyclomatic Complexity 1 drivers/scsi//mvsas/mv_init.c:mvs_iounmap

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@marvell.com>
:::::: CC: James Bottomley <James.Bottomley@HansenPartnership.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32895 bytes --]

  parent reply	other threads:[~2018-04-04 11:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04  2:15 Xidong Wang
2018-04-04 10:53 ` kbuild test robot
2018-04-04 11:39 ` kbuild test robot [this message]
2018-04-04  2:37 [PATCH 1/1] scsi:mvsas:fix " Xidong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201804041915.W4Pcgmu5%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=bianpan2016@163.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jinpu.wang@profitbricks.com \
    --cc=jthumshirn@suse.de \
    --cc=kbuild-all@01.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=peter.senna@collabora.com \
    --cc=romain.perier@collabora.com \
    --cc=wangxidong_97@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®