All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 2042/7089] drivers/message/fusion/mptfc.c:939:1-7: ERROR: missing pci_free_consistent; pci_alloc_consistent on line 907 and return without freeing on line 939
@ 2020-09-13  0:09 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-09-13  0:09 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Li Heng <liheng40@huawei.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d5b2251d63b5344ee827d3680fa79bdb9f9ddfa1
commit: 33fff97cbdc1246d59f64614e0081e393c484d02 [2042/7089] scsi: mptfc: Remove unneeded cast from memory allocation
:::::: branch date: 2 days ago
:::::: commit date: 3 weeks ago
config: i386-randconfig-c001-20200911 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/message/fusion/mptfc.c:939:1-7: ERROR: missing pci_free_consistent; pci_alloc_consistent on line 907 and return without freeing on line 939

# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=33fff97cbdc1246d59f64614e0081e393c484d02
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 33fff97cbdc1246d59f64614e0081e393c484d02
vim +939 drivers/message/fusion/mptfc.c

ca2f938efe71ca4 Michael Reed 2006-05-24  868  
ca2f938efe71ca4 Michael Reed 2006-05-24  869  static int
ca2f938efe71ca4 Michael Reed 2006-05-24  870  mptfc_GetFcPortPage1(MPT_ADAPTER *ioc, int portnum)
ca2f938efe71ca4 Michael Reed 2006-05-24  871  {
ca2f938efe71ca4 Michael Reed 2006-05-24  872  	ConfigPageHeader_t	 hdr;
ca2f938efe71ca4 Michael Reed 2006-05-24  873  	CONFIGPARMS		 cfg;
ca2f938efe71ca4 Michael Reed 2006-05-24  874  	FCPortPage1_t		*page1_alloc;
ca2f938efe71ca4 Michael Reed 2006-05-24  875  	dma_addr_t		 page1_dma;
ca2f938efe71ca4 Michael Reed 2006-05-24  876  	int			 data_sz;
ca2f938efe71ca4 Michael Reed 2006-05-24  877  	int			 rc;
ca2f938efe71ca4 Michael Reed 2006-05-24  878  
ca2f938efe71ca4 Michael Reed 2006-05-24  879  	if (portnum > 1)
ca2f938efe71ca4 Michael Reed 2006-05-24  880  		return -EINVAL;
ca2f938efe71ca4 Michael Reed 2006-05-24  881  
ca2f938efe71ca4 Michael Reed 2006-05-24  882  	/* get fcport page 1 header */
ca2f938efe71ca4 Michael Reed 2006-05-24  883  	hdr.PageVersion = 0;
ca2f938efe71ca4 Michael Reed 2006-05-24  884  	hdr.PageLength = 0;
ca2f938efe71ca4 Michael Reed 2006-05-24  885  	hdr.PageNumber = 1;
ca2f938efe71ca4 Michael Reed 2006-05-24  886  	hdr.PageType = MPI_CONFIG_PAGETYPE_FC_PORT;
ca2f938efe71ca4 Michael Reed 2006-05-24  887  	cfg.cfghdr.hdr = &hdr;
ca2f938efe71ca4 Michael Reed 2006-05-24  888  	cfg.physAddr = -1;
ca2f938efe71ca4 Michael Reed 2006-05-24  889  	cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
ca2f938efe71ca4 Michael Reed 2006-05-24  890  	cfg.dir = 0;
ca2f938efe71ca4 Michael Reed 2006-05-24  891  	cfg.pageAddr = portnum;
ca2f938efe71ca4 Michael Reed 2006-05-24  892  	cfg.timeout = 0;
ca2f938efe71ca4 Michael Reed 2006-05-24  893  
ca2f938efe71ca4 Michael Reed 2006-05-24  894  	if ((rc = mpt_config(ioc, &cfg)) != 0)
ca2f938efe71ca4 Michael Reed 2006-05-24  895  		return rc;
ca2f938efe71ca4 Michael Reed 2006-05-24  896  
ca2f938efe71ca4 Michael Reed 2006-05-24  897  	if (hdr.PageLength == 0)
ca2f938efe71ca4 Michael Reed 2006-05-24  898  		return -ENODEV;
ca2f938efe71ca4 Michael Reed 2006-05-24  899  
ca2f938efe71ca4 Michael Reed 2006-05-24  900  start_over:
ca2f938efe71ca4 Michael Reed 2006-05-24  901  
ca2f938efe71ca4 Michael Reed 2006-05-24  902  	if (ioc->fc_data.fc_port_page1[portnum].data == NULL) {
ca2f938efe71ca4 Michael Reed 2006-05-24  903  		data_sz = hdr.PageLength * 4;
ca2f938efe71ca4 Michael Reed 2006-05-24  904  		if (data_sz < sizeof(FCPortPage1_t))
ca2f938efe71ca4 Michael Reed 2006-05-24  905  			data_sz = sizeof(FCPortPage1_t);
ca2f938efe71ca4 Michael Reed 2006-05-24  906  
33fff97cbdc1246 Li Heng      2020-07-29 @907  		page1_alloc = pci_alloc_consistent(ioc->pcidev,
ca2f938efe71ca4 Michael Reed 2006-05-24  908  						data_sz,
ca2f938efe71ca4 Michael Reed 2006-05-24  909  						&page1_dma);
ca2f938efe71ca4 Michael Reed 2006-05-24  910  		if (!page1_alloc)
ca2f938efe71ca4 Michael Reed 2006-05-24  911  			return -ENOMEM;
ca2f938efe71ca4 Michael Reed 2006-05-24  912  	}
ca2f938efe71ca4 Michael Reed 2006-05-24  913  	else {
ca2f938efe71ca4 Michael Reed 2006-05-24  914  		page1_alloc = ioc->fc_data.fc_port_page1[portnum].data;
ca2f938efe71ca4 Michael Reed 2006-05-24  915  		page1_dma = ioc->fc_data.fc_port_page1[portnum].dma;
ca2f938efe71ca4 Michael Reed 2006-05-24  916  		data_sz = ioc->fc_data.fc_port_page1[portnum].pg_sz;
ca2f938efe71ca4 Michael Reed 2006-05-24  917  		if (hdr.PageLength * 4 > data_sz) {
ca2f938efe71ca4 Michael Reed 2006-05-24  918  			ioc->fc_data.fc_port_page1[portnum].data = NULL;
ca2f938efe71ca4 Michael Reed 2006-05-24  919  			pci_free_consistent(ioc->pcidev, data_sz, (u8 *)
ca2f938efe71ca4 Michael Reed 2006-05-24  920  				page1_alloc, page1_dma);
ca2f938efe71ca4 Michael Reed 2006-05-24  921  			goto start_over;
ca2f938efe71ca4 Michael Reed 2006-05-24  922  		}
ca2f938efe71ca4 Michael Reed 2006-05-24  923  	}
ca2f938efe71ca4 Michael Reed 2006-05-24  924  
ca2f938efe71ca4 Michael Reed 2006-05-24  925  	cfg.physAddr = page1_dma;
ca2f938efe71ca4 Michael Reed 2006-05-24  926  	cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
ca2f938efe71ca4 Michael Reed 2006-05-24  927  
ca2f938efe71ca4 Michael Reed 2006-05-24  928  	if ((rc = mpt_config(ioc, &cfg)) == 0) {
ca2f938efe71ca4 Michael Reed 2006-05-24  929  		ioc->fc_data.fc_port_page1[portnum].data = page1_alloc;
ca2f938efe71ca4 Michael Reed 2006-05-24  930  		ioc->fc_data.fc_port_page1[portnum].pg_sz = data_sz;
ca2f938efe71ca4 Michael Reed 2006-05-24  931  		ioc->fc_data.fc_port_page1[portnum].dma = page1_dma;
ca2f938efe71ca4 Michael Reed 2006-05-24  932  	}
ca2f938efe71ca4 Michael Reed 2006-05-24  933  	else {
ca2f938efe71ca4 Michael Reed 2006-05-24  934  		ioc->fc_data.fc_port_page1[portnum].data = NULL;
ca2f938efe71ca4 Michael Reed 2006-05-24  935  		pci_free_consistent(ioc->pcidev, data_sz, (u8 *)
ca2f938efe71ca4 Michael Reed 2006-05-24  936  			page1_alloc, page1_dma);
ca2f938efe71ca4 Michael Reed 2006-05-24  937  	}
ca2f938efe71ca4 Michael Reed 2006-05-24  938  
ca2f938efe71ca4 Michael Reed 2006-05-24 @939  	return rc;
ca2f938efe71ca4 Michael Reed 2006-05-24  940  }
ca2f938efe71ca4 Michael Reed 2006-05-24  941  

:::::: The code at line 939 was first introduced by commit
:::::: ca2f938efe71ca48cbc689db4df8d4f04b5d8f07 [SCSI] mptfc: set fibre channel fw target missing timers to one second

:::::: TO: Michael Reed <mdr@sgi.com>
:::::: CC: James Bottomley <jejb@mulgrave.il.steeleye.com>

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

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-13  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13  0:09 [linux-next:master 2042/7089] drivers/message/fusion/mptfc.c:939:1-7: ERROR: missing pci_free_consistent; pci_alloc_consistent on line 907 and return without freeing on line 939 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.