linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/usb/cdns3/cdnsp-mem.c:1076 cdnsp_mem_cleanup() warn: variable dereferenced before check 'pdev->dcbaa' (see line 1058)
@ 2021-04-28  9:49 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-04-28  9:49 UTC (permalink / raw)
  To: kbuild, Pawel Laszczak; +Cc: lkp, kbuild-all, linux-kernel, Peter Chen

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5bfc75d92efd494db37f5c4c173d3639d4772966
commit: 3d82904559f4f5a2622db1b21de3edf2eded7664 usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver
config: ia64-randconfig-m031-20210423 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/usb/cdns3/cdnsp-mem.c:1076 cdnsp_mem_cleanup() warn: variable dereferenced before check 'pdev->dcbaa' (see line 1058)

vim +1076 drivers/usb/cdns3/cdnsp-mem.c

3d82904559f4f5 Pawel Laszczak 2020-12-07  1054  void cdnsp_mem_cleanup(struct cdnsp_device *pdev)
3d82904559f4f5 Pawel Laszczak 2020-12-07  1055  {
3d82904559f4f5 Pawel Laszczak 2020-12-07  1056  	struct device *dev = pdev->dev;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1057  
3d82904559f4f5 Pawel Laszczak 2020-12-07 @1058  	cdnsp_free_priv_device(pdev);
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dereferences "pdev->dcbaa" without checking

3d82904559f4f5 Pawel Laszczak 2020-12-07  1059  	cdnsp_free_erst(pdev, &pdev->erst);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1060  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1061  	if (pdev->event_ring)
3d82904559f4f5 Pawel Laszczak 2020-12-07  1062  		cdnsp_ring_free(pdev, pdev->event_ring);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1063  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1064  	pdev->event_ring = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1065  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1066  	if (pdev->cmd_ring)
3d82904559f4f5 Pawel Laszczak 2020-12-07  1067  		cdnsp_ring_free(pdev, pdev->cmd_ring);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1068  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1069  	pdev->cmd_ring = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1070  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1071  	dma_pool_destroy(pdev->segment_pool);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1072  	pdev->segment_pool = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1073  	dma_pool_destroy(pdev->device_pool);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1074  	pdev->device_pool = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1075  
3d82904559f4f5 Pawel Laszczak 2020-12-07 @1076  	if (pdev->dcbaa)
                                                            ^^^^^^^^^^^
Too late

3d82904559f4f5 Pawel Laszczak 2020-12-07  1077  		dma_free_coherent(dev, sizeof(*pdev->dcbaa),
3d82904559f4f5 Pawel Laszczak 2020-12-07  1078  				  pdev->dcbaa, pdev->dcbaa->dma);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1079  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1080  	pdev->dcbaa = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1081  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1082  	pdev->usb2_port.exist = 0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1083  	pdev->usb3_port.exist = 0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1084  	pdev->usb2_port.port_num = 0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1085  	pdev->usb3_port.port_num = 0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1086  	pdev->active_port = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1087  }

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

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

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

only message in thread, other threads:[~2021-04-28  9:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  9:49 drivers/usb/cdns3/cdnsp-mem.c:1076 cdnsp_mem_cleanup() warn: variable dereferenced before check 'pdev->dcbaa' (see line 1058) Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).