[linux-next:master 9864/10975] include/linux/iio/buffer.h:147:32: warning: 'calculated_time' may be used uninitialized in this function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   bf976ab690dea9d0ee260fc8881fef511a0e3566
commit: 1b15c325c3def847397c1badc5dbe5914efc8d7e [9864/10975] UBSAN: run-time undefined behavior sanity checker
config: i386-randconfig-s0-01140842 (attached as .config)
reproduce:
        git checkout 1b15c325c3def847397c1badc5dbe5914efc8d7e
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   In file included from include/linux/iio/kfifo_buf.h:6:0,
                    from drivers/iio/common/ssp_sensors/ssp_iio.c:17:
   drivers/iio/common/ssp_sensors/ssp_iio.c: In function 'ssp_common_process_data':
>> include/linux/iio/buffer.h:147:32: warning: 'calculated_time' may be used uninitialized in this function [-Wmaybe-uninitialized]
      ((int64_t *)data)[ts_offset] = timestamp;
                                   ^
   drivers/iio/common/ssp_sensors/ssp_iio.c:83:10: note: 'calculated_time' was declared here
     int64_t calculated_time;
             ^
--
   In file included from arch/x86/include/asm/thread_info.h:11:0,
                    from include/linux/thread_info.h:54,
                    from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/seqlock.h:35,
                    from include/linux/time.h:5,
                    from include/linux/stat.h:18,
                    from include/linux/module.h:10,
                    from drivers/scsi/aha1542.c:9:
   drivers/scsi/aha1542.c: In function 'aha1542_queuecommand':
   arch/x86/include/asm/page.h:40:18: warning: 'cptr' may be used uninitialized in this function [-Wmaybe-uninitialized]
    #define __pa(x)  __phys_addr((unsigned long)(x))
                     ^
   drivers/scsi/aha1542.c:381:16: note: 'cptr' was declared here
     struct chain *cptr;
                   ^
   In file included from include/linux/dma-mapping.h:10:0,
                    from include/scsi/scsi_cmnd.h:4,
                    from drivers/scsi/aha1542.c:22:
>> include/linux/scatterlist.h:149:2: warning: 'sg_count' may be used uninitialized in this function [-Wmaybe-uninitialized]
     for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
     ^
   drivers/scsi/aha1542.c:378:11: note: 'sg_count' was declared here
     int mbo, sg_count;
              ^

vim +/calculated_time +147 include/linux/iio/buffer.h

d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  131   * @data:		sample data
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  132   * @timestamp:		timestamp for the sample data
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  133   *
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  134   * Pushes data to the IIO device's buffers. If timestamps are enabled for the
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  135   * device the function will store the supplied timestamp as the last element in
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  136   * the sample data buffer before pushing it to the device buffers. The sample
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  137   * data buffer needs to be large enough to hold the additional timestamp
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  138   * (usually the buffer should be indio->scan_bytes bytes large).
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  139   *
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  140   * Returns 0 on success, a negative error code otherwise.
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  141   */
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  142  static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  143  	void *data, int64_t timestamp)
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  144  {
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  145  	if (indio_dev->scan_timestamp) {
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  146  		size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19 @147  		((int64_t *)data)[ts_offset] = timestamp;
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  148  	}
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  149  
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  150  	return iio_push_to_buffers(indio_dev, data);
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  151  }
d2c3d072 include/linux/iio/buffer.h   Lars-Peter Clausen 2013-09-19  152  
5ada4ea9 drivers/staging/iio/buffer.h Jonathan Cameron   2011-12-05  153  int iio_update_demux(struct iio_dev *indio_dev);
5ada4ea9 drivers/staging/iio/buffer.h Jonathan Cameron   2011-12-05  154  
81636632 include/linux/iio/buffer.h   Lars-Peter Clausen 2012-07-09  155  bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,

:::::: The code at line 147 was first introduced by commit
:::::: d2c3d072c4aded65f0632223cc0d3a8a2e577b3a iio: Add iio_push_buffers_with_timestamp() helper

:::::: TO: Lars-Peter Clausen <lars@xxxxxxxxxx>
:::::: CC: Jonathan Cameron <jic23@xxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: Binary data


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]