All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [lee-linaro:tb-fix-w1-warnings 216/226] drivers/scsi/mpt3sas/mpt3sas_scsih.c:10244 _scsih_scan_for_devices_after_reset() warn: possible memory leak of 'volume_pg0'
Date: Sat, 27 Feb 2021 18:01:44 +0300	[thread overview]
Message-ID: <20210227150143.GH2087@kadam> (raw)

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

tree:   https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head:   49fe493a5f7cebaec70944df919df3350d4cb520
commit: a5ab8c19b6f704742e181af8b429a208e9a0e393 [216/226] fixup! scsi: mpt3sas: mpt3sas_scs: Move a little data from the stack onto the heap
config: xtensa-randconfig-m031-20210227 (attached as .config)
compiler: xtensa-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>

New smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_scsih.c:10244 _scsih_scan_for_devices_after_reset() warn: possible memory leak of 'volume_pg0'

Old smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_scsih.c:6865 _scsih_expander_add() warn: returning -1 instead of -ENOMEM is sloppy
drivers/scsi/mpt3sas/mpt3sas_scsih.c:6885 _scsih_expander_add() warn: missing error code 'rc'
drivers/scsi/mpt3sas/mpt3sas_scsih.c:10650 _mpt3sas_fw_work() warn: inconsistent indenting

vim +/volume_pg0 +10244 drivers/scsi/mpt3sas/mpt3sas_scsih.c

f92363d12359498f Sreekanth Reddy          2012-11-30  10216  static void
f92363d12359498f Sreekanth Reddy          2012-11-30  10217  _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
f92363d12359498f Sreekanth Reddy          2012-11-30  10218  {
f92363d12359498f Sreekanth Reddy          2012-11-30  10219  	Mpi2ExpanderPage0_t expander_pg0;
f92363d12359498f Sreekanth Reddy          2012-11-30  10220  	Mpi2SasDevicePage0_t sas_device_pg0;
ec051e5a4bbaa989 Suganath Prabu Subramani 2017-10-31  10221  	Mpi26PCIeDevicePage0_t pcie_device_pg0;
16dc4b15325d1db7 Lee Jones                2021-02-25  10222  	Mpi2RaidVolPage1_t *volume_pg1;
16dc4b15325d1db7 Lee Jones                2021-02-25  10223  	Mpi2RaidVolPage0_t *volume_pg0;
f92363d12359498f Sreekanth Reddy          2012-11-30  10224  	Mpi2RaidPhysDiskPage0_t pd_pg0;
f92363d12359498f Sreekanth Reddy          2012-11-30  10225  	Mpi2EventIrConfigElement_t element;
f92363d12359498f Sreekanth Reddy          2012-11-30  10226  	Mpi2ConfigReply_t mpi_reply;
e2f0cdf7525353d8 Sreekanth Reddy          2020-10-27  10227  	u8 phys_disk_num, port_id;
f92363d12359498f Sreekanth Reddy          2012-11-30  10228  	u16 ioc_status;
f92363d12359498f Sreekanth Reddy          2012-11-30  10229  	u16 handle, parent_handle;
f92363d12359498f Sreekanth Reddy          2012-11-30  10230  	u64 sas_address;
f92363d12359498f Sreekanth Reddy          2012-11-30  10231  	struct _sas_device *sas_device;
ec051e5a4bbaa989 Suganath Prabu Subramani 2017-10-31  10232  	struct _pcie_device *pcie_device;
f92363d12359498f Sreekanth Reddy          2012-11-30  10233  	struct _sas_node *expander_device;
f92363d12359498f Sreekanth Reddy          2012-11-30  10234  	static struct _raid_device *raid_device;
f92363d12359498f Sreekanth Reddy          2012-11-30  10235  	u8 retry_count;
f92363d12359498f Sreekanth Reddy          2012-11-30  10236  	unsigned long flags;
f92363d12359498f Sreekanth Reddy          2012-11-30  10237  
16dc4b15325d1db7 Lee Jones                2021-02-25  10238  	volume_pg0 = kzalloc(sizeof(*volume_pg0), GFP_KERNEL);
16dc4b15325d1db7 Lee Jones                2021-02-25  10239  	if (!volume_pg0)
16dc4b15325d1db7 Lee Jones                2021-02-25  10240  		return;
16dc4b15325d1db7 Lee Jones                2021-02-25  10241  
16dc4b15325d1db7 Lee Jones                2021-02-25  10242  	volume_pg1 = kzalloc(sizeof(*volume_pg1), GFP_KERNEL);
16dc4b15325d1db7 Lee Jones                2021-02-25  10243  	if (!volume_pg1)
16dc4b15325d1db7 Lee Jones                2021-02-25 @10244  		return;

kfree(volume_pg0) before returning?

16dc4b15325d1db7 Lee Jones                2021-02-25  10245  
919d8a3f3fef9910 Joe Perches              2018-09-17  10246  	ioc_info(ioc, "scan devices: start\n");
---
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: 38518 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [lee-linaro:tb-fix-w1-warnings 216/226] drivers/scsi/mpt3sas/mpt3sas_scsih.c:10244 _scsih_scan_for_devices_after_reset() warn: possible memory leak of 'volume_pg0'
Date: Sat, 27 Feb 2021 18:01:44 +0300	[thread overview]
Message-ID: <20210227150143.GH2087@kadam> (raw)

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

tree:   https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head:   49fe493a5f7cebaec70944df919df3350d4cb520
commit: a5ab8c19b6f704742e181af8b429a208e9a0e393 [216/226] fixup! scsi: mpt3sas: mpt3sas_scs: Move a little data from the stack onto the heap
config: xtensa-randconfig-m031-20210227 (attached as .config)
compiler: xtensa-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>

New smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_scsih.c:10244 _scsih_scan_for_devices_after_reset() warn: possible memory leak of 'volume_pg0'

Old smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_scsih.c:6865 _scsih_expander_add() warn: returning -1 instead of -ENOMEM is sloppy
drivers/scsi/mpt3sas/mpt3sas_scsih.c:6885 _scsih_expander_add() warn: missing error code 'rc'
drivers/scsi/mpt3sas/mpt3sas_scsih.c:10650 _mpt3sas_fw_work() warn: inconsistent indenting

vim +/volume_pg0 +10244 drivers/scsi/mpt3sas/mpt3sas_scsih.c

f92363d12359498f Sreekanth Reddy          2012-11-30  10216  static void
f92363d12359498f Sreekanth Reddy          2012-11-30  10217  _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
f92363d12359498f Sreekanth Reddy          2012-11-30  10218  {
f92363d12359498f Sreekanth Reddy          2012-11-30  10219  	Mpi2ExpanderPage0_t expander_pg0;
f92363d12359498f Sreekanth Reddy          2012-11-30  10220  	Mpi2SasDevicePage0_t sas_device_pg0;
ec051e5a4bbaa989 Suganath Prabu Subramani 2017-10-31  10221  	Mpi26PCIeDevicePage0_t pcie_device_pg0;
16dc4b15325d1db7 Lee Jones                2021-02-25  10222  	Mpi2RaidVolPage1_t *volume_pg1;
16dc4b15325d1db7 Lee Jones                2021-02-25  10223  	Mpi2RaidVolPage0_t *volume_pg0;
f92363d12359498f Sreekanth Reddy          2012-11-30  10224  	Mpi2RaidPhysDiskPage0_t pd_pg0;
f92363d12359498f Sreekanth Reddy          2012-11-30  10225  	Mpi2EventIrConfigElement_t element;
f92363d12359498f Sreekanth Reddy          2012-11-30  10226  	Mpi2ConfigReply_t mpi_reply;
e2f0cdf7525353d8 Sreekanth Reddy          2020-10-27  10227  	u8 phys_disk_num, port_id;
f92363d12359498f Sreekanth Reddy          2012-11-30  10228  	u16 ioc_status;
f92363d12359498f Sreekanth Reddy          2012-11-30  10229  	u16 handle, parent_handle;
f92363d12359498f Sreekanth Reddy          2012-11-30  10230  	u64 sas_address;
f92363d12359498f Sreekanth Reddy          2012-11-30  10231  	struct _sas_device *sas_device;
ec051e5a4bbaa989 Suganath Prabu Subramani 2017-10-31  10232  	struct _pcie_device *pcie_device;
f92363d12359498f Sreekanth Reddy          2012-11-30  10233  	struct _sas_node *expander_device;
f92363d12359498f Sreekanth Reddy          2012-11-30  10234  	static struct _raid_device *raid_device;
f92363d12359498f Sreekanth Reddy          2012-11-30  10235  	u8 retry_count;
f92363d12359498f Sreekanth Reddy          2012-11-30  10236  	unsigned long flags;
f92363d12359498f Sreekanth Reddy          2012-11-30  10237  
16dc4b15325d1db7 Lee Jones                2021-02-25  10238  	volume_pg0 = kzalloc(sizeof(*volume_pg0), GFP_KERNEL);
16dc4b15325d1db7 Lee Jones                2021-02-25  10239  	if (!volume_pg0)
16dc4b15325d1db7 Lee Jones                2021-02-25  10240  		return;
16dc4b15325d1db7 Lee Jones                2021-02-25  10241  
16dc4b15325d1db7 Lee Jones                2021-02-25  10242  	volume_pg1 = kzalloc(sizeof(*volume_pg1), GFP_KERNEL);
16dc4b15325d1db7 Lee Jones                2021-02-25  10243  	if (!volume_pg1)
16dc4b15325d1db7 Lee Jones                2021-02-25 @10244  		return;

kfree(volume_pg0) before returning?

16dc4b15325d1db7 Lee Jones                2021-02-25  10245  
919d8a3f3fef9910 Joe Perches              2018-09-17  10246  	ioc_info(ioc, "scan devices: start\n");
---
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: 38518 bytes --]

             reply	other threads:[~2021-02-27 15:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-27 15:01 Dan Carpenter [this message]
2021-02-27 15:01 ` [lee-linaro:tb-fix-w1-warnings 216/226] drivers/scsi/mpt3sas/mpt3sas_scsih.c:10244 _scsih_scan_for_devices_after_reset() warn: possible memory leak of 'volume_pg0' Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-02-27  1:26 kernel test robot

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=20210227150143.GH2087@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /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 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.