lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202201271857.MGiOkhFo-lkp@intel.com>
Date:   Thu, 27 Jan 2022 14:33:50 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        robh+dt@...nel.org, gregkh@...uxfoundation.org
Cc:     lkp@...el.com, kbuild-all@...ts.01.org, devicetree@...r.kernel.org,
        ekangupt@....qualcomm.com, bkumar@....qualcomm.com,
        linux-kernel@...r.kernel.org, srini@...nel.org,
        bjorn.andersson@...aro.org, linux-arm-msm@...r.kernel.org,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: Re: [PATCH v3 01/12] misc: fastrpc: separate fastrpc device from
 channel context

Hi Srinivas,

url:    https://github.com/0day-ci/linux/commits/Srinivas-Kandagatla/misc-fastrpc-Add-missing-DSP-FastRPC-features/20220126-215705
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 515a2f507491e7c3818e74ef4f4e088c1fecb190
config: openrisc-randconfig-m031-20220124 (https://download.01.org/0day-ci/archive/20220127/202201271857.MGiOkhFo-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0

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

New smatch warnings:
drivers/misc/fastrpc.c:1636 fastrpc_device_register() warn: passing devm_ allocated variable to kfree. 'fdev'

vim +/fdev +1636 drivers/misc/fastrpc.c

99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1620  static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ctx *cctx,
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1621  				   const char *domain)
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1622  {
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1623  	struct fastrpc_device *fdev;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1624  	int err;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1625  
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1626  	fdev = devm_kzalloc(dev, sizeof(*fdev), GFP_KERNEL);
                                                        ^^^^^^^^^^^^^^^^^^^

99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1627  	if (!fdev)
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1628  		return -ENOMEM;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1629  
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1630  	fdev->cctx = cctx;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1631  	fdev->miscdev.minor = MISC_DYNAMIC_MINOR;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1632  	fdev->miscdev.fops = &fastrpc_fops;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1633  	fdev->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "fastrpc-%s", domain);
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1634  	err = misc_register(&fdev->miscdev);
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1635  	if (err)
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26 @1636  		kfree(fdev);
                                                                ^^^^^^^^^^^
Double free

99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1637  	else
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1638  		cctx->fdevice = fdev;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1639  
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1640  	return err;
99d9d7a1c5f2dae Srinivas Kandagatla 2022-01-26  1641  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ