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] [day] [month] [year] [list]
Message-ID: <202112290340.PMwi47LV-lkp@intel.com>
Date:   Thu, 6 Jan 2022 13:53:31 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        William Breathitt Gray <vilhelm.gray@...il.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        Lars-Peter Clausen <lars@...afoo.de>, kernel@...gutronix.de,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        linux-iio@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 13/23] counter: Provide alternative counter
 registration functions

Hi "Uwe,

url:    https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/counter-cleanups-and-device-lifetime-fixes/20211227-174815
base:   a7904a538933c525096ca2ccde1e60d0ee62c08e
config: i386-randconfig-m021-20211227 (https://download.01.org/0day-ci/archive/20211229/202112290340.PMwi47LV-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.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>

smatch warnings:
drivers/counter/counter-core.c:175 counter_alloc() error: uninitialized symbol 'id'.

vim +/id +175 drivers/counter/counter-core.c

250e0e3d91caea Uwe Kleine-König       2021-12-27  144  struct counter_device *counter_alloc(size_t sizeof_priv)
250e0e3d91caea Uwe Kleine-König       2021-12-27  145  {
250e0e3d91caea Uwe Kleine-König       2021-12-27  146  	struct counter_device_allochelper *ch;
250e0e3d91caea Uwe Kleine-König       2021-12-27  147  	struct counter_device *counter;
250e0e3d91caea Uwe Kleine-König       2021-12-27  148  	struct device *dev;
250e0e3d91caea Uwe Kleine-König       2021-12-27  149  	int id, err;
250e0e3d91caea Uwe Kleine-König       2021-12-27  150  
250e0e3d91caea Uwe Kleine-König       2021-12-27  151  	ch = kzalloc(sizeof(*ch) + sizeof_priv, GFP_KERNEL);
250e0e3d91caea Uwe Kleine-König       2021-12-27  152  	if (!ch) {
250e0e3d91caea Uwe Kleine-König       2021-12-27  153  		err = -ENOMEM;
250e0e3d91caea Uwe Kleine-König       2021-12-27  154  		goto err_alloc_ch;
250e0e3d91caea Uwe Kleine-König       2021-12-27  155  	}
250e0e3d91caea Uwe Kleine-König       2021-12-27  156  
250e0e3d91caea Uwe Kleine-König       2021-12-27  157  	counter = &ch->counter;
250e0e3d91caea Uwe Kleine-König       2021-12-27  158  	dev = &counter->dev;
250e0e3d91caea Uwe Kleine-König       2021-12-27  159  
250e0e3d91caea Uwe Kleine-König       2021-12-27  160  	/* Acquire unique ID */
250e0e3d91caea Uwe Kleine-König       2021-12-27  161  	err = ida_alloc(&counter_ida, GFP_KERNEL);
250e0e3d91caea Uwe Kleine-König       2021-12-27  162  	if (err < 0) {
250e0e3d91caea Uwe Kleine-König       2021-12-27  163  		goto err_ida_alloc;
250e0e3d91caea Uwe Kleine-König       2021-12-27  164  	}
250e0e3d91caea Uwe Kleine-König       2021-12-27  165  	dev->id = err;
250e0e3d91caea Uwe Kleine-König       2021-12-27  166  
250e0e3d91caea Uwe Kleine-König       2021-12-27  167  	err = counter_chrdev_add(counter);
250e0e3d91caea Uwe Kleine-König       2021-12-27  168  	if (err < 0)
250e0e3d91caea Uwe Kleine-König       2021-12-27  169  		goto err_chrdev_add;
250e0e3d91caea Uwe Kleine-König       2021-12-27  170  
250e0e3d91caea Uwe Kleine-König       2021-12-27  171  	device_initialize(dev);
250e0e3d91caea Uwe Kleine-König       2021-12-27  172  	/* Configure device structure for Counter */
250e0e3d91caea Uwe Kleine-König       2021-12-27  173  	dev->type = &counter_device_type;
250e0e3d91caea Uwe Kleine-König       2021-12-27  174  	dev->bus = &counter_bus_type;
250e0e3d91caea Uwe Kleine-König       2021-12-27 @175  	dev->devt = MKDEV(MAJOR(counter_devt), id);

"id" is uninitialized.  Should this be "dev->id"?

250e0e3d91caea Uwe Kleine-König       2021-12-27  176  
250e0e3d91caea Uwe Kleine-König       2021-12-27  177  	mutex_init(&counter->ops_exist_lock);
250e0e3d91caea Uwe Kleine-König       2021-12-27  178  
250e0e3d91caea Uwe Kleine-König       2021-12-27  179  	return counter;
250e0e3d91caea Uwe Kleine-König       2021-12-27  180  
250e0e3d91caea Uwe Kleine-König       2021-12-27  181  err_chrdev_add:
250e0e3d91caea Uwe Kleine-König       2021-12-27  182  
250e0e3d91caea Uwe Kleine-König       2021-12-27  183  	ida_free(&counter_ida, dev->id);
250e0e3d91caea Uwe Kleine-König       2021-12-27  184  err_ida_alloc:
250e0e3d91caea Uwe Kleine-König       2021-12-27  185  
250e0e3d91caea Uwe Kleine-König       2021-12-27  186  	kfree(ch);
250e0e3d91caea Uwe Kleine-König       2021-12-27  187  err_alloc_ch:
250e0e3d91caea Uwe Kleine-König       2021-12-27  188  
250e0e3d91caea Uwe Kleine-König       2021-12-27  189  	return ERR_PTR(err);
250e0e3d91caea Uwe Kleine-König       2021-12-27  190  }

---
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