All of lore.kernel.org
 help / color / mirror / Atom feed
* [iio:testing 17/95] drivers/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58
@ 2020-08-31 12:52 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-08-31 12:52 UTC (permalink / raw)
  To: kbuild

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   283d2403beb406f0906cfbb2c9d7aa61cbcbbeed
commit: 77ed24daa40b3ce41610268d8307a50d82b382ad [17/95] iio: light: as73211: New driver
config: mips-randconfig-m031-20200831 (attached as .config)
compiler: mips-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/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58

# https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=77ed24daa40b3ce41610268d8307a50d82b382ad
git remote add iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git fetch --no-tags iio testing
git checkout 77ed24daa40b3ce41610268d8307a50d82b382ad
vim +213 drivers/iio/light/as73211.c

77ed24daa40b3c Christian Eggers 2020-08-05  206  static void as73211_integration_time_calc_avail(struct as73211_data *data)
77ed24daa40b3c Christian Eggers 2020-08-05  207  {
77ed24daa40b3c Christian Eggers 2020-08-05  208  	int i;
77ed24daa40b3c Christian Eggers 2020-08-05  209  
77ed24daa40b3c Christian Eggers 2020-08-05  210  	for (i = 0; i < ARRAY_SIZE(data->int_time_avail); i++) {
                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

77ed24daa40b3c Christian Eggers 2020-08-05  211  		unsigned int time_us = as73211_integration_time_us(data, BIT(i));
77ed24daa40b3c Christian Eggers 2020-08-05  212  
77ed24daa40b3c Christian Eggers 2020-08-05 @213  		data->int_time_avail[i * 2 + 0] = time_us / USEC_PER_SEC;
                                                                                     ^^^^^^^^^
Buffer overflow

77ed24daa40b3c Christian Eggers 2020-08-05  214  		data->int_time_avail[i * 2 + 1] = time_us % USEC_PER_SEC;
                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^

77ed24daa40b3c Christian Eggers 2020-08-05  215  	}
77ed24daa40b3c Christian Eggers 2020-08-05  216  }

---
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: 34488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [iio:testing 17/95] drivers/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58
@ 2020-08-31 12:52 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-08-31 12:52 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   283d2403beb406f0906cfbb2c9d7aa61cbcbbeed
commit: 77ed24daa40b3ce41610268d8307a50d82b382ad [17/95] iio: light: as73211: New driver
config: mips-randconfig-m031-20200831 (attached as .config)
compiler: mips-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/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58

# https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=77ed24daa40b3ce41610268d8307a50d82b382ad
git remote add iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git fetch --no-tags iio testing
git checkout 77ed24daa40b3ce41610268d8307a50d82b382ad
vim +213 drivers/iio/light/as73211.c

77ed24daa40b3c Christian Eggers 2020-08-05  206  static void as73211_integration_time_calc_avail(struct as73211_data *data)
77ed24daa40b3c Christian Eggers 2020-08-05  207  {
77ed24daa40b3c Christian Eggers 2020-08-05  208  	int i;
77ed24daa40b3c Christian Eggers 2020-08-05  209  
77ed24daa40b3c Christian Eggers 2020-08-05  210  	for (i = 0; i < ARRAY_SIZE(data->int_time_avail); i++) {
                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

77ed24daa40b3c Christian Eggers 2020-08-05  211  		unsigned int time_us = as73211_integration_time_us(data, BIT(i));
77ed24daa40b3c Christian Eggers 2020-08-05  212  
77ed24daa40b3c Christian Eggers 2020-08-05 @213  		data->int_time_avail[i * 2 + 0] = time_us / USEC_PER_SEC;
                                                                                     ^^^^^^^^^
Buffer overflow

77ed24daa40b3c Christian Eggers 2020-08-05  214  		data->int_time_avail[i * 2 + 1] = time_us % USEC_PER_SEC;
                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^

77ed24daa40b3c Christian Eggers 2020-08-05  215  	}
77ed24daa40b3c Christian Eggers 2020-08-05  216  }

---
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: 34488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [iio:testing 17/95] drivers/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58
  2020-08-31 12:52 ` Dan Carpenter
  (?)
@ 2020-08-31 13:22 ` Andy Shevchenko
  -1 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-08-31 13:22 UTC (permalink / raw)
  To: kbuild-all

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

On Mon, Aug 31, 2020 at 3:53 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> head:   283d2403beb406f0906cfbb2c9d7aa61cbcbbeed
> commit: 77ed24daa40b3ce41610268d8307a50d82b382ad [17/95] iio: light: as73211: New driver
> config: mips-randconfig-m031-20200831 (attached as .config)
> compiler: mips-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>


Good catch! This
  int int_time_avail[AS73211_SAMPLE_TIME_NUM * 2];
should be like
  int int_time_avail[AS73211_SAMPLE_TIME_NUM][2];

and code changed accordingly.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [iio:testing 17/95] drivers/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58
@ 2020-08-31 12:03 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-08-31 12:03 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Christian Eggers <ceggers@arri.de>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
CC: Andy Shevchenko <andy.shevchenko@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   283d2403beb406f0906cfbb2c9d7aa61cbcbbeed
commit: 77ed24daa40b3ce41610268d8307a50d82b382ad [17/95] iio: light: as73211: New driver
:::::: branch date: 3 hours ago
:::::: commit date: 2 days ago
config: mips-randconfig-m031-20200831 (attached as .config)
compiler: mips-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/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58

Old smatch warnings:
drivers/iio/light/as73211.c:214 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 59

# https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=77ed24daa40b3ce41610268d8307a50d82b382ad
git remote add iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git fetch --no-tags iio testing
git checkout 77ed24daa40b3ce41610268d8307a50d82b382ad
vim +213 drivers/iio/light/as73211.c

77ed24daa40b3c Christian Eggers 2020-08-05  205  
77ed24daa40b3c Christian Eggers 2020-08-05  206  static void as73211_integration_time_calc_avail(struct as73211_data *data)
77ed24daa40b3c Christian Eggers 2020-08-05  207  {
77ed24daa40b3c Christian Eggers 2020-08-05  208  	int i;
77ed24daa40b3c Christian Eggers 2020-08-05  209  
77ed24daa40b3c Christian Eggers 2020-08-05  210  	for (i = 0; i < ARRAY_SIZE(data->int_time_avail); i++) {
77ed24daa40b3c Christian Eggers 2020-08-05  211  		unsigned int time_us = as73211_integration_time_us(data, BIT(i));
77ed24daa40b3c Christian Eggers 2020-08-05  212  
77ed24daa40b3c Christian Eggers 2020-08-05 @213  		data->int_time_avail[i * 2 + 0] = time_us / USEC_PER_SEC;
77ed24daa40b3c Christian Eggers 2020-08-05  214  		data->int_time_avail[i * 2 + 1] = time_us % USEC_PER_SEC;
77ed24daa40b3c Christian Eggers 2020-08-05  215  	}
77ed24daa40b3c Christian Eggers 2020-08-05  216  }
77ed24daa40b3c Christian Eggers 2020-08-05  217  

---
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: 34488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-31 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 12:52 [iio:testing 17/95] drivers/iio/light/as73211.c:213 as73211_integration_time_calc_avail() error: buffer overflow 'data->int_time_avail' 30 <= 58 Dan Carpenter
2020-08-31 12:52 ` Dan Carpenter
2020-08-31 13:22 ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2020-08-31 12:03 kernel test robot

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.