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: <20210125110642.GN20820@kadam>
Date:   Mon, 25 Jan 2021 14:06:42 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Cc:     lkp@...el.com, kbuild-all@...ts.01.org, lars@...afoo.de,
        Michael.Hennerich@...log.com, jic23@...nel.org, nuno.sa@...log.com,
        dragos.bogdan@...log.com,
        Alexandru Ardelean <alexandru.ardelean@...log.com>
Subject: [kbuild] Re: [PATCH v2 11/12][RESEND] iio: buffer: introduce support
 for attaching more IIO buffers

Hi Alexandru,

I love your patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/iio-core-buffer-add-support-for-multiple-IIO-buffers-per-IIO-device/20210125-053419
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git  togreg
config: i386-randconfig-m021-20210125 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-20) 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/iio/industrialio-buffer.c:1606 iio_buffer_alloc_sysfs_and_mask() error: uninitialized symbol 'cnt'.

vim +/cnt +1606 drivers/iio/industrialio-buffer.c

e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1562  int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
d967cb6bd4e79c0c Lars-Peter Clausen 2014-11-26  1563  {
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1564  	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
ff3f7e049aef9202 Alexandru Ardelean 2020-04-24  1565  	struct iio_buffer *buffer = indio_dev->buffer;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1566  	const struct iio_chan_spec *channels;
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1567  	int i, cnt, ret;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1568  
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1569  	channels = indio_dev->channels;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1570  	if (channels) {
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1571  		int ml = indio_dev->masklength;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1572  
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1573  		for (i = 0; i < indio_dev->num_channels; i++)
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1574  			ml = max(ml, channels[i].scan_index + 1);
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1575  		indio_dev->masklength = ml;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1576  	}
ff3f7e049aef9202 Alexandru Ardelean 2020-04-24  1577  
ff3f7e049aef9202 Alexandru Ardelean 2020-04-24  1578  	if (!buffer)
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1579  		return 0;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1580  
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1581  	for (i = 0; i < iio_dev_opaque->attached_buffers_cnt; i++) {
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1582  		buffer = iio_dev_opaque->attached_buffers[i];
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1583  		ret = __iio_buffer_alloc_sysfs_and_mask(buffer, indio_dev, i);
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1584  		if (ret)
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1585  			goto error_unwind_sysfs_and_mask;

"cnt" is not set here.

8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1586  	}
d967cb6bd4e79c0c Lars-Peter Clausen 2014-11-26  1587  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1588  	ret = sysfs_create_link(&indio_dev->dev.kobj,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1589  				&indio_dev->buffer->buffer_dir,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1590  				"buffer");
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1591  	if (ret)
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1592  		goto error_unwind_sysfs_and_mask;

Oh here.

e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1593  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1594  	ret = sysfs_create_link(&indio_dev->dev.kobj,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1595  				&indio_dev->buffer->scan_el_dir,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1596  				"scan_elements");
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1597  	if (ret)
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1598  		goto error_remove_buffer_dir_link;
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1599  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1600  	return 0;
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1601  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1602  error_remove_buffer_dir_link:
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1603  	sysfs_remove_link(&indio_dev->dev.kobj, "buffer");
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1604  	cnt = iio_dev_opaque->attached_buffers_cnt - 1;
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1605  error_unwind_sysfs_and_mask:
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22 @1606  	for (; cnt >= 0; cnt--) {
                                                               ^^^^^^^^
Uninitialized.

8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1607  		buffer = iio_dev_opaque->attached_buffers[cnt];
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1608  		__iio_buffer_free_sysfs_and_mask(buffer);
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1609  	}
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1610  	kfree(iio_dev_opaque->attached_buffers);
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1611  	iio_dev_opaque->attached_buffers = NULL;
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1612  	return ret;
d967cb6bd4e79c0c Lars-Peter Clausen 2014-11-26  1613  }

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

Download attachment ".config.gz" of type "application/gzip" (30447 bytes)

_______________________________________________
kbuild mailing list -- kbuild@...ts.01.org
To unsubscribe send an email to kbuild-leave@...ts.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ