drivers/iio/adc/max1027.c:412:14: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Miquel Raynal <miquel.raynal(a)bootlin.com>
CC: 0day robot <lkp(a)intel.com>
tree: https://github.com/0day-ci/linux/commits/Miquel-Raynal/Bring-external-tri...
head: 82403933ab13283e98041a4c285420988531362c
commit: 1e80dcadd79f6dec7346dc596fbafd508ea2844e iio: adc: max1027: Minimize the number of converted channels
date: 9 days ago
:::::: branch date: 9 days ago
:::::: commit date: 9 days ago
config: riscv-randconfig-c006-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/1e80dcadd79f6dec7346dc596fbafd508...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miquel-Raynal/Bring-external-triggers-support-to-MAX1027-like-ADCs/20210922-131741
git checkout 1e80dcadd79f6dec7346dc596fbafd508ea2844e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
Suppressed 12 warnings (12 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
31 warnings generated.
Suppressed 31 warnings (10 in non-user code, 21 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
23 warnings generated.
Suppressed 23 warnings (10 in non-user code, 13 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
drivers/iio/accel/bma180.c:197:36: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
u8 reg_val = (ret & ~mask) | (val << (ffs(mask) - 1));
^
drivers/iio/accel/bma180.c:914:8: note: Calling 'bma180_reset_intr'
ret = bma180_reset_intr(data);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/accel/bma180.c:207:12: note: Calling 'bma180_set_bits'
int ret = bma180_set_bits(data, data->part_info->int_reset_reg,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/accel/bma180.c:197:36: note: The result of the left shift is undefined because the right operand is negative
u8 reg_val = (ret & ~mask) | (val << (ffs(mask) - 1));
^ ~~~~~~~~~~~~~~~
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
Suppressed 12 warnings (12 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
Suppressed 12 warnings (12 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
Suppressed 12 warnings (12 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
Suppressed 12 warnings (12 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
drivers/iio/adc/max1027.c:265:8: warning: Excessive padding in 'struct max1027_state' (99 padding bytes, where 35 is optimal).
Optimal fields order:
reg,
info,
spi,
trig,
buffer,
lock,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct max1027_state {
~~~~~~~^~~~~~~~~~~~~~~
drivers/iio/adc/max1027.c:265:8: note: Excessive padding in 'struct max1027_state' (99 padding bytes, where 35 is optimal). Optimal fields order: reg, info, spi, trig, buffer, lock, consider reordering the fields or adding explicit padding members
struct max1027_state {
~~~~~~~^~~~~~~~~~~~~~~
>> drivers/iio/adc/max1027.c:412:14: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
^
drivers/iio/adc/max1027.c:38:32: note: expanded from macro 'MAX1027_CHAN'
#define MAX1027_CHAN(n) ((n) << 3)
~~~ ^
drivers/iio/adc/max1027.c:399:6: note: Assuming 'state' is true
if (state) {
^~~~~
drivers/iio/adc/max1027.c:399:2: note: Taking true branch
if (state) {
^
drivers/iio/adc/max1027.c:404:7: note: Assuming 'ret' is >= 0
if (ret < 0)
^~~~~~~
drivers/iio/adc/max1027.c:404:3: note: Taking false branch
if (ret < 0)
^
drivers/iio/adc/max1027.c:412:14: note: The result of the left shift is undefined because the left operand is negative
st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
^
drivers/iio/adc/max1027.c:38:32: note: expanded from macro 'MAX1027_CHAN'
#define MAX1027_CHAN(n) ((n) << 3)
~~~ ^
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/adc/max11100.c:31:8: warning: Excessive padding in 'struct max11100_state' (117 padding bytes, where 53 is optimal).
Optimal fields order:
buffer,
vref_reg,
spi,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct max11100_state {
~~~~~~~^~~~~~~~~~~~~~~~
drivers/iio/adc/max11100.c:31:8: note: Excessive padding in 'struct max11100_state' (117 padding bytes, where 53 is optimal). Optimal fields order: buffer, vref_reg, spi, consider reordering the fields or adding explicit padding members
struct max11100_state {
~~~~~~~^~~~~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/adc/max1241.c:22:8: warning: Excessive padding in 'struct max1241' (98 padding bytes, where 34 is optimal).
Optimal fields order:
data,
spi,
vdd,
vref,
shutdown,
lock,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct max1241 {
~~~~~~~^~~~~~~~~
drivers/iio/adc/max1241.c:22:8: note: Excessive padding in 'struct max1241' (98 padding bytes, where 34 is optimal). Optimal fields order: data, spi, vdd, vref, shutdown, lock, consider reordering the fields or adding explicit padding members
struct max1241 {
~~~~~~~^~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/dac/ti-dac7311.c:47:8: warning: Excessive padding in 'struct ti_dac_chip' (101 padding bytes, where 37 is optimal).
Optimal fields order:
buf,
val,
vref,
spi,
lock,
powerdown,
powerdown_mode,
resolution,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct ti_dac_chip {
~~~~~~~^~~~~~~~~~~~~
drivers/iio/dac/ti-dac7311.c:47:8: note: Excessive padding in 'struct ti_dac_chip' (101 padding bytes, where 37 is optimal). Optimal fields order: buf, val, vref, spi, lock, powerdown, powerdown_mode, resolution, consider reordering the fields or adding explicit padding members
struct ti_dac_chip {
~~~~~~~^~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
drivers/iio/gyro/adis16130.c:41:8: warning: Excessive padding in 'struct adis16130_state' (108 padding bytes, where 44 is optimal).
Optimal fields order:
buf,
us,
buf_lock,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct adis16130_state {
~~~~~~~^~~~~~~~~~~~~~~~~
drivers/iio/gyro/adis16130.c:41:8: note: Excessive padding in 'struct adis16130_state' (108 padding bytes, where 44 is optimal). Optimal fields order: buf, us, buf_lock, consider reordering the fields or adding explicit padding members
struct adis16130_state {
~~~~~~~^~~~~~~~~~~~~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
vim +412 drivers/iio/adc/max1027.c
fc167f62483325 Philippe Reynes 2014-06-14 264
fc167f62483325 Philippe Reynes 2014-06-14 @265 struct max1027_state {
fc167f62483325 Philippe Reynes 2014-06-14 266 const struct max1027_chip_info *info;
fc167f62483325 Philippe Reynes 2014-06-14 267 struct spi_device *spi;
fc167f62483325 Philippe Reynes 2014-06-14 268 struct iio_trigger *trig;
fc167f62483325 Philippe Reynes 2014-06-14 269 __be16 *buffer;
fc167f62483325 Philippe Reynes 2014-06-14 270 struct mutex lock;
fc167f62483325 Philippe Reynes 2014-06-14 271
fc167f62483325 Philippe Reynes 2014-06-14 272 u8 reg ____cacheline_aligned;
fc167f62483325 Philippe Reynes 2014-06-14 273 };
fc167f62483325 Philippe Reynes 2014-06-14 274
fc167f62483325 Philippe Reynes 2014-06-14 275 static int max1027_read_single_value(struct iio_dev *indio_dev,
fc167f62483325 Philippe Reynes 2014-06-14 276 struct iio_chan_spec const *chan,
fc167f62483325 Philippe Reynes 2014-06-14 277 int *val)
fc167f62483325 Philippe Reynes 2014-06-14 278 {
fc167f62483325 Philippe Reynes 2014-06-14 279 int ret;
fc167f62483325 Philippe Reynes 2014-06-14 280 struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14 281
fc167f62483325 Philippe Reynes 2014-06-14 282 if (iio_buffer_enabled(indio_dev)) {
fc167f62483325 Philippe Reynes 2014-06-14 283 dev_warn(&indio_dev->dev, "trigger mode already enabled");
fc167f62483325 Philippe Reynes 2014-06-14 284 return -EBUSY;
fc167f62483325 Philippe Reynes 2014-06-14 285 }
fc167f62483325 Philippe Reynes 2014-06-14 286
fc167f62483325 Philippe Reynes 2014-06-14 287 /* Start acquisition on conversion register write */
fc167f62483325 Philippe Reynes 2014-06-14 288 st->reg = MAX1027_SETUP_REG | MAX1027_REF_MODE2 | MAX1027_CKS_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14 289 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 290 if (ret < 0) {
fc167f62483325 Philippe Reynes 2014-06-14 291 dev_err(&indio_dev->dev,
fc167f62483325 Philippe Reynes 2014-06-14 292 "Failed to configure setup register\n");
fc167f62483325 Philippe Reynes 2014-06-14 293 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 294 }
fc167f62483325 Philippe Reynes 2014-06-14 295
fc167f62483325 Philippe Reynes 2014-06-14 296 /* Configure conversion register with the requested chan */
fc167f62483325 Philippe Reynes 2014-06-14 297 st->reg = MAX1027_CONV_REG | MAX1027_CHAN(chan->channel) |
58b90a8d2c397a Sandhya Bankar 2016-09-24 298 MAX1027_NOSCAN;
58b90a8d2c397a Sandhya Bankar 2016-09-24 299 if (chan->type == IIO_TEMP)
58b90a8d2c397a Sandhya Bankar 2016-09-24 300 st->reg |= MAX1027_TEMP;
fc167f62483325 Philippe Reynes 2014-06-14 301 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 302 if (ret < 0) {
fc167f62483325 Philippe Reynes 2014-06-14 303 dev_err(&indio_dev->dev,
fc167f62483325 Philippe Reynes 2014-06-14 304 "Failed to configure conversion register\n");
fc167f62483325 Philippe Reynes 2014-06-14 305 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 306 }
fc167f62483325 Philippe Reynes 2014-06-14 307
fc167f62483325 Philippe Reynes 2014-06-14 308 /*
fc167f62483325 Philippe Reynes 2014-06-14 309 * For an unknown reason, when we use the mode "10" (write
fc167f62483325 Philippe Reynes 2014-06-14 310 * conversion register), the interrupt doesn't occur every time.
fc167f62483325 Philippe Reynes 2014-06-14 311 * So we just wait 1 ms.
fc167f62483325 Philippe Reynes 2014-06-14 312 */
fc167f62483325 Philippe Reynes 2014-06-14 313 mdelay(1);
fc167f62483325 Philippe Reynes 2014-06-14 314
fc167f62483325 Philippe Reynes 2014-06-14 315 /* Read result */
fc167f62483325 Philippe Reynes 2014-06-14 316 ret = spi_read(st->spi, st->buffer, (chan->type == IIO_TEMP) ? 4 : 2);
fc167f62483325 Philippe Reynes 2014-06-14 317 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 318 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 319
fc167f62483325 Philippe Reynes 2014-06-14 320 *val = be16_to_cpu(st->buffer[0]);
fc167f62483325 Philippe Reynes 2014-06-14 321
fc167f62483325 Philippe Reynes 2014-06-14 322 return IIO_VAL_INT;
fc167f62483325 Philippe Reynes 2014-06-14 323 }
fc167f62483325 Philippe Reynes 2014-06-14 324
fc167f62483325 Philippe Reynes 2014-06-14 325 static int max1027_read_raw(struct iio_dev *indio_dev,
fc167f62483325 Philippe Reynes 2014-06-14 326 struct iio_chan_spec const *chan,
fc167f62483325 Philippe Reynes 2014-06-14 327 int *val, int *val2, long mask)
fc167f62483325 Philippe Reynes 2014-06-14 328 {
fc167f62483325 Philippe Reynes 2014-06-14 329 int ret = 0;
fc167f62483325 Philippe Reynes 2014-06-14 330 struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14 331
fc167f62483325 Philippe Reynes 2014-06-14 332 mutex_lock(&st->lock);
fc167f62483325 Philippe Reynes 2014-06-14 333
fc167f62483325 Philippe Reynes 2014-06-14 334 switch (mask) {
fc167f62483325 Philippe Reynes 2014-06-14 335 case IIO_CHAN_INFO_RAW:
fc167f62483325 Philippe Reynes 2014-06-14 336 ret = max1027_read_single_value(indio_dev, chan, val);
fc167f62483325 Philippe Reynes 2014-06-14 337 break;
fc167f62483325 Philippe Reynes 2014-06-14 338 case IIO_CHAN_INFO_SCALE:
fc167f62483325 Philippe Reynes 2014-06-14 339 switch (chan->type) {
fc167f62483325 Philippe Reynes 2014-06-14 340 case IIO_TEMP:
fc167f62483325 Philippe Reynes 2014-06-14 341 *val = 1;
fc167f62483325 Philippe Reynes 2014-06-14 342 *val2 = 8;
fc167f62483325 Philippe Reynes 2014-06-14 343 ret = IIO_VAL_FRACTIONAL;
fc167f62483325 Philippe Reynes 2014-06-14 344 break;
fc167f62483325 Philippe Reynes 2014-06-14 345 case IIO_VOLTAGE:
fc167f62483325 Philippe Reynes 2014-06-14 346 *val = 2500;
7af5257d84275c Miquel Raynal 2019-10-11 347 *val2 = chan->scan_type.realbits;
fc167f62483325 Philippe Reynes 2014-06-14 348 ret = IIO_VAL_FRACTIONAL_LOG2;
fc167f62483325 Philippe Reynes 2014-06-14 349 break;
fc167f62483325 Philippe Reynes 2014-06-14 350 default:
fc167f62483325 Philippe Reynes 2014-06-14 351 ret = -EINVAL;
fc167f62483325 Philippe Reynes 2014-06-14 352 break;
fc167f62483325 Philippe Reynes 2014-06-14 353 }
fc167f62483325 Philippe Reynes 2014-06-14 354 break;
fc167f62483325 Philippe Reynes 2014-06-14 355 default:
fc167f62483325 Philippe Reynes 2014-06-14 356 ret = -EINVAL;
fc167f62483325 Philippe Reynes 2014-06-14 357 break;
fc167f62483325 Philippe Reynes 2014-06-14 358 }
fc167f62483325 Philippe Reynes 2014-06-14 359
fc167f62483325 Philippe Reynes 2014-06-14 360 mutex_unlock(&st->lock);
fc167f62483325 Philippe Reynes 2014-06-14 361
fc167f62483325 Philippe Reynes 2014-06-14 362 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 363 }
fc167f62483325 Philippe Reynes 2014-06-14 364
fc167f62483325 Philippe Reynes 2014-06-14 365 static int max1027_debugfs_reg_access(struct iio_dev *indio_dev,
825ca5fefb8af9 Miquel Raynal 2021-09-21 366 unsigned int reg, unsigned int writeval,
825ca5fefb8af9 Miquel Raynal 2021-09-21 367 unsigned int *readval)
fc167f62483325 Philippe Reynes 2014-06-14 368 {
fc167f62483325 Philippe Reynes 2014-06-14 369 struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14 370 u8 *val = (u8 *)st->buffer;
fc167f62483325 Philippe Reynes 2014-06-14 371
038696f8bd2f2e Miquel Raynal 2019-10-11 372 if (readval) {
038696f8bd2f2e Miquel Raynal 2019-10-11 373 int ret = spi_read(st->spi, val, 2);
038696f8bd2f2e Miquel Raynal 2019-10-11 374 *readval = be16_to_cpu(st->buffer[0]);
038696f8bd2f2e Miquel Raynal 2019-10-11 375 return ret;
038696f8bd2f2e Miquel Raynal 2019-10-11 376 }
fc167f62483325 Philippe Reynes 2014-06-14 377
fc167f62483325 Philippe Reynes 2014-06-14 378 *val = (u8)writeval;
fc167f62483325 Philippe Reynes 2014-06-14 379 return spi_write(st->spi, val, 1);
fc167f62483325 Philippe Reynes 2014-06-14 380 }
fc167f62483325 Philippe Reynes 2014-06-14 381
fc167f62483325 Philippe Reynes 2014-06-14 382 static int max1027_validate_trigger(struct iio_dev *indio_dev,
fc167f62483325 Philippe Reynes 2014-06-14 383 struct iio_trigger *trig)
fc167f62483325 Philippe Reynes 2014-06-14 384 {
fc167f62483325 Philippe Reynes 2014-06-14 385 struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14 386
fc167f62483325 Philippe Reynes 2014-06-14 387 if (st->trig != trig)
fc167f62483325 Philippe Reynes 2014-06-14 388 return -EINVAL;
fc167f62483325 Philippe Reynes 2014-06-14 389
fc167f62483325 Philippe Reynes 2014-06-14 390 return 0;
fc167f62483325 Philippe Reynes 2014-06-14 391 }
fc167f62483325 Philippe Reynes 2014-06-14 392
fc167f62483325 Philippe Reynes 2014-06-14 393 static int max1027_set_trigger_state(struct iio_trigger *trig, bool state)
fc167f62483325 Philippe Reynes 2014-06-14 394 {
fc167f62483325 Philippe Reynes 2014-06-14 395 struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
fc167f62483325 Philippe Reynes 2014-06-14 396 struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14 397 int ret;
fc167f62483325 Philippe Reynes 2014-06-14 398
fc167f62483325 Philippe Reynes 2014-06-14 399 if (state) {
fc167f62483325 Philippe Reynes 2014-06-14 400 /* Start acquisition on cnvst */
fc167f62483325 Philippe Reynes 2014-06-14 401 st->reg = MAX1027_SETUP_REG | MAX1027_CKS_MODE0 |
fc167f62483325 Philippe Reynes 2014-06-14 402 MAX1027_REF_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14 403 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 404 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 405 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 406
1e80dcadd79f6d Miquel Raynal 2021-09-21 407 /*
1e80dcadd79f6d Miquel Raynal 2021-09-21 408 * Scan from chan 0 to the highest requested channel.
1e80dcadd79f6d Miquel Raynal 2021-09-21 409 * Include temperature on demand.
1e80dcadd79f6d Miquel Raynal 2021-09-21 410 */
1e80dcadd79f6d Miquel Raynal 2021-09-21 411 st->reg = MAX1027_CONV_REG | MAX1027_SCAN_0_N;
1e80dcadd79f6d Miquel Raynal 2021-09-21 @412 st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
1e80dcadd79f6d Miquel Raynal 2021-09-21 413 if (*indio_dev->active_scan_mask & MAX1X27_SCAN_MASK_TEMP)
1e80dcadd79f6d Miquel Raynal 2021-09-21 414 st->reg |= MAX1027_TEMP;
1e80dcadd79f6d Miquel Raynal 2021-09-21 415
fc167f62483325 Philippe Reynes 2014-06-14 416 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 417 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 418 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 419 } else {
fc167f62483325 Philippe Reynes 2014-06-14 420 /* Start acquisition on conversion register write */
fc167f62483325 Philippe Reynes 2014-06-14 421 st->reg = MAX1027_SETUP_REG | MAX1027_CKS_MODE2 |
fc167f62483325 Philippe Reynes 2014-06-14 422 MAX1027_REF_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14 423 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 424 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 425 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 426 }
fc167f62483325 Philippe Reynes 2014-06-14 427
fc167f62483325 Philippe Reynes 2014-06-14 428 return 0;
fc167f62483325 Philippe Reynes 2014-06-14 429 }
fc167f62483325 Philippe Reynes 2014-06-14 430
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
[rhvgoyal:notification-queue 5/8] fs/fuse/virtio_fs.c:827:17: sparse: sparse: no generic selection for 'unsigned int virtio_cread_v'
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Vivek Goyal <vgoyal(a)redhat.com>
CC: Ioannis Angelakopoulos <iangelak(a)redhat.com>
tree: https://github.com/rhvgoyal/linux notification-queue
head: 8a74e3a5793e164bac09552c801823eabdb841b1
commit: 78212035be092b3d3f56e3601b2350e86493dff8 [5/8] virtiofs: Add a virtqueue for notifications
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-s001-20210930 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/rhvgoyal/linux/commit/78212035be092b3d3f56e3601b2350e8...
git remote add rhvgoyal https://github.com/rhvgoyal/linux
git fetch --no-tags rhvgoyal notification-queue
git checkout 78212035be092b3d3f56e3601b2350e86493dff8
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash fs/fuse/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> fs/fuse/virtio_fs.c:827:17: sparse: sparse: no generic selection for 'unsigned int virtio_cread_v'
>> fs/fuse/virtio_fs.c:827:17: sparse: sparse: incompatible types in comparison expression (different base types):
>> fs/fuse/virtio_fs.c:827:17: sparse: bad type *
>> fs/fuse/virtio_fs.c:827:17: sparse: unsigned int *
>> fs/fuse/virtio_fs.c:827:17: sparse: sparse: no generic selection for 'unsigned int [addressable] virtio_cread_v'
vim +827 fs/fuse/virtio_fs.c
b43b7e81eb2b18 Vivek Goyal 2020-08-19 809
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 810 /* Initialize virtqueues */
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 811 static int virtio_fs_setup_vqs(struct virtio_device *vdev,
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 812 struct virtio_fs *fs)
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 813 {
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 814 struct virtqueue **vqs;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 815 vq_callback_t **callbacks;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 816 const char **names;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 817 unsigned int i;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 818 int ret = 0;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 819
2c0349ec1a8ee6 Michael S. Tsirkin 2020-08-05 820 virtio_cread_le(vdev, struct virtio_fs_config, num_request_queues,
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 821 &fs->num_request_queues);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 822 if (fs->num_request_queues == 0)
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 823 return -EINVAL;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 824
78212035be092b Vivek Goyal 2021-09-30 825 if (virtio_has_feature(vdev, VIRTIO_FS_F_NOTIFICATION)) {
78212035be092b Vivek Goyal 2021-09-30 826 fs->notify_enabled = true;
78212035be092b Vivek Goyal 2021-09-30 @827 virtio_cread(vdev, struct virtio_fs_config, notify_buf_size,
78212035be092b Vivek Goyal 2021-09-30 828 &fs->notify_buf_size);
78212035be092b Vivek Goyal 2021-09-30 829 if (fs->notify_buf_size <= sizeof(struct fuse_out_header)) {
78212035be092b Vivek Goyal 2021-09-30 830 pr_err("virtio-fs: Invalid value %d of notification buffer size\n",
78212035be092b Vivek Goyal 2021-09-30 831 fs->notify_buf_size);
78212035be092b Vivek Goyal 2021-09-30 832 return -EINVAL;
78212035be092b Vivek Goyal 2021-09-30 833 }
78212035be092b Vivek Goyal 2021-09-30 834 pr_info("virtio-fs: device supports notification. Notification_buf_size=%u\n",
78212035be092b Vivek Goyal 2021-09-30 835 fs->notify_buf_size);
78212035be092b Vivek Goyal 2021-09-30 836 }
78212035be092b Vivek Goyal 2021-09-30 837
78212035be092b Vivek Goyal 2021-09-30 838 if (fs->notify_enabled) {
78212035be092b Vivek Goyal 2021-09-30 839 /* One additional queue for hiprio and one for notifications */
78212035be092b Vivek Goyal 2021-09-30 840 fs->nvqs = 2 + fs->num_request_queues;
78212035be092b Vivek Goyal 2021-09-30 841 fs->first_reqq_idx = VQ_NOTIFY_IDX + 1;
78212035be092b Vivek Goyal 2021-09-30 842 } else {
db6f0eafcba856 Vivek Goyal 2021-09-30 843 fs->nvqs = 1 + fs->num_request_queues;
db6f0eafcba856 Vivek Goyal 2021-09-30 844 fs->first_reqq_idx = 1;
78212035be092b Vivek Goyal 2021-09-30 845 }
78212035be092b Vivek Goyal 2021-09-30 846
cde214bdd169d9 Vivek Goyal 2021-09-30 847 fs->vqs = kcalloc(fs->nvqs, sizeof(fs->vqs[VQ_HIPRIO_IDX]), GFP_KERNEL);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 848 if (!fs->vqs)
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 849 return -ENOMEM;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 850
cde214bdd169d9 Vivek Goyal 2021-09-30 851 vqs = kmalloc_array(fs->nvqs, sizeof(vqs[VQ_HIPRIO_IDX]), GFP_KERNEL);
cde214bdd169d9 Vivek Goyal 2021-09-30 852 callbacks = kmalloc_array(fs->nvqs, sizeof(callbacks[VQ_HIPRIO_IDX]),
cde214bdd169d9 Vivek Goyal 2021-09-30 853 GFP_KERNEL);
cde214bdd169d9 Vivek Goyal 2021-09-30 854 names = kmalloc_array(fs->nvqs, sizeof(names[VQ_HIPRIO_IDX]),
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 855 GFP_KERNEL);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 856 if (!vqs || !callbacks || !names) {
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 857 ret = -ENOMEM;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 858 goto out;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 859 }
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 860
b43b7e81eb2b18 Vivek Goyal 2020-08-19 861 /* Initialize the hiprio/forget request virtqueue */
cde214bdd169d9 Vivek Goyal 2021-09-30 862 callbacks[VQ_HIPRIO_IDX] = virtio_fs_vq_done;
78212035be092b Vivek Goyal 2021-09-30 863 ret = virtio_fs_init_vq(fs, &fs->vqs[VQ_HIPRIO_IDX], "hiprio",
78212035be092b Vivek Goyal 2021-09-30 864 VQ_TYPE_HIPRIO);
78212035be092b Vivek Goyal 2021-09-30 865 if (ret < 0)
78212035be092b Vivek Goyal 2021-09-30 866 goto out;
cde214bdd169d9 Vivek Goyal 2021-09-30 867 names[VQ_HIPRIO_IDX] = fs->vqs[VQ_HIPRIO_IDX].name;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 868
78212035be092b Vivek Goyal 2021-09-30 869 /* Initialize notification queue */
78212035be092b Vivek Goyal 2021-09-30 870 if (fs->notify_enabled) {
78212035be092b Vivek Goyal 2021-09-30 871 callbacks[VQ_NOTIFY_IDX] = virtio_fs_vq_done;
78212035be092b Vivek Goyal 2021-09-30 872 ret = virtio_fs_init_vq(fs, &fs->vqs[VQ_NOTIFY_IDX],
78212035be092b Vivek Goyal 2021-09-30 873 "notification", VQ_TYPE_NOTIFY);
78212035be092b Vivek Goyal 2021-09-30 874 if (ret < 0)
78212035be092b Vivek Goyal 2021-09-30 875 goto out;
78212035be092b Vivek Goyal 2021-09-30 876 names[VQ_NOTIFY_IDX] = fs->vqs[VQ_NOTIFY_IDX].name;
78212035be092b Vivek Goyal 2021-09-30 877 }
78212035be092b Vivek Goyal 2021-09-30 878
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 879 /* Initialize the requests virtqueues */
db6f0eafcba856 Vivek Goyal 2021-09-30 880 for (i = fs->first_reqq_idx; i < fs->nvqs; i++) {
b43b7e81eb2b18 Vivek Goyal 2020-08-19 881 char vq_name[VQ_NAME_LEN];
b43b7e81eb2b18 Vivek Goyal 2020-08-19 882
db6f0eafcba856 Vivek Goyal 2021-09-30 883 snprintf(vq_name, VQ_NAME_LEN, "requests.%u",
db6f0eafcba856 Vivek Goyal 2021-09-30 884 i - fs->first_reqq_idx);
78212035be092b Vivek Goyal 2021-09-30 885 ret = virtio_fs_init_vq(fs, &fs->vqs[i], vq_name,
78212035be092b Vivek Goyal 2021-09-30 886 VQ_TYPE_REQUEST);
78212035be092b Vivek Goyal 2021-09-30 887 if (ret < 0)
78212035be092b Vivek Goyal 2021-09-30 888 goto out;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 889 callbacks[i] = virtio_fs_vq_done;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 890 names[i] = fs->vqs[i].name;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 891 }
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 892
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 893 ret = virtio_find_vqs(vdev, fs->nvqs, vqs, callbacks, names, NULL);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 894 if (ret < 0)
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 895 goto out;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 896
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 897 for (i = 0; i < fs->nvqs; i++)
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 898 fs->vqs[i].vq = vqs[i];
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 899 out:
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 900 kfree(names);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 901 kfree(callbacks);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 902 kfree(vqs);
78212035be092b Vivek Goyal 2021-09-30 903 if (ret) {
78212035be092b Vivek Goyal 2021-09-30 904 virtio_fs_free_notify_nodes(fs);
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 905 kfree(fs->vqs);
78212035be092b Vivek Goyal 2021-09-30 906 }
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 907 return ret;
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 908 }
a62a8ef9d97da2 Stefan Hajnoczi 2018-06-12 909
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang...
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Olivier Moysan <olivier.moysan(a)st.com>
CC: Mark Brown <broonie(a)kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
commit: 8a262e614ef8675cfde924c6ddf873a95db0be6a ASoC: stm32: i2s: add master clock provider
date: 8 months ago
:::::: branch date: 31 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8a262e614ef8675cfde924c6ddf873a95db0be6a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^ ~
drivers/vme/bridges/vme_tsi148.c:1217:4: note: Value stored to 'done' is never read
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:1237:3: warning: Value stored to 'done' is never read [clang-analyzer-deadcode.DeadStores]
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:1237:3: note: Value stored to 'done' is never read
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:1302:4: warning: Value stored to 'done' is never read [clang-analyzer-deadcode.DeadStores]
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:1302:4: note: Value stored to 'done' is never read
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:1322:3: warning: Value stored to 'done' is never read [clang-analyzer-deadcode.DeadStores]
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:1322:3: note: Value stored to 'done' is never read
done += 1;
^ ~
drivers/vme/bridges/vme_tsi148.c:2338:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(tsi148_bridge->name, driver_name);
^~~~~~
drivers/vme/bridges/vme_tsi148.c:2338:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(tsi148_bridge->name, driver_name);
^~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1 warning generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
drivers/media/platform/davinci/vpbe.c:631:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = -ENOMEM;
^ ~~~~~~~
drivers/media/platform/davinci/vpbe.c:631:4: note: Value stored to 'err' is never read
err = -ENOMEM;
^ ~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (16 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
drivers/media/platform/atmel/atmel-isc-base.c:379:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct isc_clk *isc_clk = to_isc_clk(hw);
^~~~~~~
drivers/media/platform/atmel/atmel-isc-base.c:379:18: note: Value stored to 'isc_clk' during its initialization is never read
struct isc_clk *isc_clk = to_isc_clk(hw);
^~~~~~~
drivers/media/platform/atmel/atmel-isc-base.c:962:2: warning: Value stored to 'i' is never read [clang-analyzer-deadcode.DeadStores]
i = 0;
^ ~
drivers/media/platform/atmel/atmel-isc-base.c:962:2: note: Value stored to 'i' is never read
i = 0;
^ ~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
>> sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(p, "_mclk");
^~~~~~
sound/soc/stm/stm32_i2s.c:434:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(p, "_mclk");
^~~~~~
sound/soc/stm/stm32_i2s.c:455:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = i2s->pdev;
^~~~ ~~~~~~~~~
sound/soc/stm/stm32_i2s.c:455:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = i2s->pdev;
^~~~ ~~~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
34 warnings generated.
drivers/video/fbdev/nvidia/nvidia.c:124:4: warning: Value stored to 'tmp' is never read [clang-analyzer-deadcode.DeadStores]
tmp = 0;
^ ~
drivers/video/fbdev/nvidia/nvidia.c:124:4: note: Value stored to 'tmp' is never read
tmp = 0;
^ ~
Suppressed 32 warnings (32 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
20 warnings generated.
40 warnings generated.
drivers/video/fbdev/nvidia/nv_hw.c:261:2: warning: Value stored to 'clwm' is never read [clang-analyzer-deadcode.DeadStores]
clwm = 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:261:2: note: Value stored to 'clwm' is never read
clwm = 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:284:2: warning: Value stored to 'pclks' is never read [clang-analyzer-deadcode.DeadStores]
pclks += 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:284:2: note: Value stored to 'pclks' is never read
pclks += 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:439:2: warning: Value stored to 'clwm' is never read [clang-analyzer-deadcode.DeadStores]
clwm = 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:439:2: note: Value stored to 'clwm' is never read
clwm = 0;
^ ~
Suppressed 34 warnings (32 in non-user code, 2 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
36 warnings generated.
Suppressed 36 warnings (32 in non-user code, 4 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
32 warnings generated.
Suppressed 32 warnings (32 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
vim +434 sound/soc/stm/stm32_i2s.c
8a262e614ef8675 Olivier Moysan 2021-02-05 406
8a262e614ef8675 Olivier Moysan 2021-02-05 407 static int stm32_i2s_add_mclk_provider(struct stm32_i2s_data *i2s)
8a262e614ef8675 Olivier Moysan 2021-02-05 408 {
8a262e614ef8675 Olivier Moysan 2021-02-05 409 struct clk_hw *hw;
8a262e614ef8675 Olivier Moysan 2021-02-05 410 struct stm32_i2smclk_data *mclk;
8a262e614ef8675 Olivier Moysan 2021-02-05 411 struct device *dev = &i2s->pdev->dev;
8a262e614ef8675 Olivier Moysan 2021-02-05 412 const char *pname = __clk_get_name(i2s->i2sclk);
8a262e614ef8675 Olivier Moysan 2021-02-05 413 char *mclk_name, *p, *s = (char *)pname;
8a262e614ef8675 Olivier Moysan 2021-02-05 414 int ret, i = 0;
8a262e614ef8675 Olivier Moysan 2021-02-05 415
8a262e614ef8675 Olivier Moysan 2021-02-05 416 mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL);
8a262e614ef8675 Olivier Moysan 2021-02-05 417 if (!mclk)
8a262e614ef8675 Olivier Moysan 2021-02-05 418 return -ENOMEM;
8a262e614ef8675 Olivier Moysan 2021-02-05 419
8a262e614ef8675 Olivier Moysan 2021-02-05 420 mclk_name = devm_kcalloc(dev, sizeof(char),
8a262e614ef8675 Olivier Moysan 2021-02-05 421 STM32_I2S_NAME_LEN, GFP_KERNEL);
8a262e614ef8675 Olivier Moysan 2021-02-05 422 if (!mclk_name)
8a262e614ef8675 Olivier Moysan 2021-02-05 423 return -ENOMEM;
8a262e614ef8675 Olivier Moysan 2021-02-05 424
8a262e614ef8675 Olivier Moysan 2021-02-05 425 /*
8a262e614ef8675 Olivier Moysan 2021-02-05 426 * Forge mclk clock name from parent clock name and suffix.
8a262e614ef8675 Olivier Moysan 2021-02-05 427 * String after "_" char is stripped in parent name.
8a262e614ef8675 Olivier Moysan 2021-02-05 428 */
8a262e614ef8675 Olivier Moysan 2021-02-05 429 p = mclk_name;
8a262e614ef8675 Olivier Moysan 2021-02-05 430 while (*s && *s != '_' && (i < (STM32_I2S_NAME_LEN - 7))) {
8a262e614ef8675 Olivier Moysan 2021-02-05 431 *p++ = *s++;
8a262e614ef8675 Olivier Moysan 2021-02-05 432 i++;
8a262e614ef8675 Olivier Moysan 2021-02-05 433 }
8a262e614ef8675 Olivier Moysan 2021-02-05 @434 strcat(p, "_mclk");
8a262e614ef8675 Olivier Moysan 2021-02-05 435
8a262e614ef8675 Olivier Moysan 2021-02-05 436 mclk->hw.init = CLK_HW_INIT(mclk_name, pname, &mclk_ops, 0);
8a262e614ef8675 Olivier Moysan 2021-02-05 437 mclk->i2s_data = i2s;
8a262e614ef8675 Olivier Moysan 2021-02-05 438 hw = &mclk->hw;
8a262e614ef8675 Olivier Moysan 2021-02-05 439
8a262e614ef8675 Olivier Moysan 2021-02-05 440 dev_dbg(dev, "Register master clock %s\n", mclk_name);
8a262e614ef8675 Olivier Moysan 2021-02-05 441 ret = devm_clk_hw_register(&i2s->pdev->dev, hw);
8a262e614ef8675 Olivier Moysan 2021-02-05 442 if (ret) {
8a262e614ef8675 Olivier Moysan 2021-02-05 443 dev_err(dev, "mclk register fails with error %d\n", ret);
8a262e614ef8675 Olivier Moysan 2021-02-05 444 return ret;
8a262e614ef8675 Olivier Moysan 2021-02-05 445 }
8a262e614ef8675 Olivier Moysan 2021-02-05 446 i2s->i2smclk = hw->clk;
8a262e614ef8675 Olivier Moysan 2021-02-05 447
8a262e614ef8675 Olivier Moysan 2021-02-05 448 /* register mclk provider */
8a262e614ef8675 Olivier Moysan 2021-02-05 449 return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
8a262e614ef8675 Olivier Moysan 2021-02-05 450 }
8a262e614ef8675 Olivier Moysan 2021-02-05 451
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
fs/btrfs/ioctl.c:1951 btrfs_ioctl_snap_create_v2() warn: comparison of a potentially tagged address (btrfs_ioctl_snap_create_v2, -2, inherit->num_qgroups)
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Dan Carpenter <error27(a)gmail.com>
CC: David Sterba <dsterba(a)suse.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
commit: 5011c5a663b9c6d6aff3d394f11049b371199627 btrfs: validate qgroup inherit for SNAP_CREATE_V2 ioctl
date: 7 months ago
:::::: branch date: 25 hours ago
:::::: commit date: 7 months ago
config: arm64-randconfig-m031-20210929 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
fs/btrfs/ioctl.c:1951 btrfs_ioctl_snap_create_v2() warn: comparison of a potentially tagged address (btrfs_ioctl_snap_create_v2, -2, inherit->num_qgroups)
fs/btrfs/ioctl.c:1952 btrfs_ioctl_snap_create_v2() warn: comparison of a potentially tagged address (btrfs_ioctl_snap_create_v2, -2, inherit->num_ref_copies)
fs/btrfs/ioctl.c:1953 btrfs_ioctl_snap_create_v2() warn: comparison of a potentially tagged address (btrfs_ioctl_snap_create_v2, -2, inherit->num_excl_copies)
Old smatch warnings:
fs/btrfs/ioctl.c:893 create_snapshot() warn: '&pending_snapshot->list' not removed from list
fs/btrfs/ioctl.c:1652 btrfs_defrag_file() warn: should 'ret << 12' be a 64 bit type?
fs/btrfs/ioctl.c:1941 btrfs_ioctl_snap_create_v2() warn: comparison of a potentially tagged address (btrfs_ioctl_snap_create_v2, -2, vol_args->size)
vim +1951 fs/btrfs/ioctl.c
fa0d2b9bd71734 Li Zefan 2010-12-20 1913
fa0d2b9bd71734 Li Zefan 2010-12-20 1914 static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
fa0d2b9bd71734 Li Zefan 2010-12-20 1915 void __user *arg, int subvol)
fa0d2b9bd71734 Li Zefan 2010-12-20 1916 {
fa0d2b9bd71734 Li Zefan 2010-12-20 1917 struct btrfs_ioctl_vol_args_v2 *vol_args;
fa0d2b9bd71734 Li Zefan 2010-12-20 1918 int ret;
b83cc9693f3968 Li Zefan 2010-12-20 1919 bool readonly = false;
6f72c7e20dbaea Arne Jansen 2011-09-14 1920 struct btrfs_qgroup_inherit *inherit = NULL;
fdfb1e4f6c6147 Li Zefan 2010-12-10 1921
325c50e3cebb92 Jeff Mahoney 2016-09-21 1922 if (!S_ISDIR(file_inode(file)->i_mode))
325c50e3cebb92 Jeff Mahoney 2016-09-21 1923 return -ENOTDIR;
325c50e3cebb92 Jeff Mahoney 2016-09-21 1924
fa0d2b9bd71734 Li Zefan 2010-12-20 1925 vol_args = memdup_user(arg, sizeof(*vol_args));
fa0d2b9bd71734 Li Zefan 2010-12-20 1926 if (IS_ERR(vol_args))
fa0d2b9bd71734 Li Zefan 2010-12-20 1927 return PTR_ERR(vol_args);
fa0d2b9bd71734 Li Zefan 2010-12-20 1928 vol_args->name[BTRFS_SUBVOL_NAME_MAX] = '\0';
fdfb1e4f6c6147 Li Zefan 2010-12-10 1929
673990dba332d9 David Sterba 2020-02-21 1930 if (vol_args->flags & ~BTRFS_SUBVOL_CREATE_ARGS_MASK) {
b83cc9693f3968 Li Zefan 2010-12-20 1931 ret = -EOPNOTSUPP;
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1932 goto free_args;
fdfb1e4f6c6147 Li Zefan 2010-12-10 1933 }
fdfb1e4f6c6147 Li Zefan 2010-12-10 1934
b83cc9693f3968 Li Zefan 2010-12-20 1935 if (vol_args->flags & BTRFS_SUBVOL_RDONLY)
b83cc9693f3968 Li Zefan 2010-12-20 1936 readonly = true;
6f72c7e20dbaea Arne Jansen 2011-09-14 1937 if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
5011c5a663b9c6 Dan Carpenter 2021-02-17 1938 u64 nums;
5011c5a663b9c6 Dan Carpenter 2021-02-17 1939
5011c5a663b9c6 Dan Carpenter 2021-02-17 1940 if (vol_args->size < sizeof(*inherit) ||
5011c5a663b9c6 Dan Carpenter 2021-02-17 1941 vol_args->size > PAGE_SIZE) {
6f72c7e20dbaea Arne Jansen 2011-09-14 1942 ret = -EINVAL;
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1943 goto free_args;
6f72c7e20dbaea Arne Jansen 2011-09-14 1944 }
6f72c7e20dbaea Arne Jansen 2011-09-14 1945 inherit = memdup_user(vol_args->qgroup_inherit, vol_args->size);
6f72c7e20dbaea Arne Jansen 2011-09-14 1946 if (IS_ERR(inherit)) {
6f72c7e20dbaea Arne Jansen 2011-09-14 1947 ret = PTR_ERR(inherit);
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1948 goto free_args;
6f72c7e20dbaea Arne Jansen 2011-09-14 1949 }
5011c5a663b9c6 Dan Carpenter 2021-02-17 1950
5011c5a663b9c6 Dan Carpenter 2021-02-17 @1951 if (inherit->num_qgroups > PAGE_SIZE ||
5011c5a663b9c6 Dan Carpenter 2021-02-17 @1952 inherit->num_ref_copies > PAGE_SIZE ||
5011c5a663b9c6 Dan Carpenter 2021-02-17 @1953 inherit->num_excl_copies > PAGE_SIZE) {
5011c5a663b9c6 Dan Carpenter 2021-02-17 1954 ret = -EINVAL;
5011c5a663b9c6 Dan Carpenter 2021-02-17 1955 goto free_inherit;
5011c5a663b9c6 Dan Carpenter 2021-02-17 1956 }
5011c5a663b9c6 Dan Carpenter 2021-02-17 1957
5011c5a663b9c6 Dan Carpenter 2021-02-17 1958 nums = inherit->num_qgroups + 2 * inherit->num_ref_copies +
5011c5a663b9c6 Dan Carpenter 2021-02-17 1959 2 * inherit->num_excl_copies;
5011c5a663b9c6 Dan Carpenter 2021-02-17 1960 if (vol_args->size != struct_size(inherit, qgroups, nums)) {
5011c5a663b9c6 Dan Carpenter 2021-02-17 1961 ret = -EINVAL;
5011c5a663b9c6 Dan Carpenter 2021-02-17 1962 goto free_inherit;
5011c5a663b9c6 Dan Carpenter 2021-02-17 1963 }
6f72c7e20dbaea Arne Jansen 2011-09-14 1964 }
75eaa0e22c055e Sage Weil 2010-12-10 1965
5d54c67eccb489 Nikolay Borisov 2020-03-13 1966 ret = __btrfs_ioctl_snap_create(file, vol_args->name, vol_args->fd,
5d54c67eccb489 Nikolay Borisov 2020-03-13 1967 subvol, readonly, inherit);
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1968 if (ret)
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1969 goto free_inherit;
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1970 free_inherit:
6f72c7e20dbaea Arne Jansen 2011-09-14 1971 kfree(inherit);
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1972 free_args:
c47ca32d3aadb2 Dan Carpenter 2014-09-04 1973 kfree(vol_args);
f46b5a66b3316e Christoph Hellwig 2008-06-11 1974 return ret;
f46b5a66b3316e Christoph Hellwig 2008-06-11 1975 }
f46b5a66b3316e Christoph Hellwig 2008-06-11 1976
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
drivers/soc/sifive/sifive_l2_cache.c:235 sifive_l2_init() warn: 'l2_base' not released on lines: 215.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Yash Shah <yash.shah(a)sifive.com>
CC: Palmer Dabbelt <palmerdabbelt(a)google.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
commit: 507308b8ccc90d37b07bfca8ffe130435d6b354f RISC-V: sifive_l2_cache: Update L2 cache driver to support SiFive FU740
date: 9 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 9 months ago
config: riscv-randconfig-m031-20210930 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/soc/sifive/sifive_l2_cache.c:235 sifive_l2_init() warn: 'l2_base' not released on lines: 215.
vim +/l2_base +235 drivers/soc/sifive/sifive_l2_cache.c
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 194
bf6df5dd25b7440 arch/riscv/mm/sifive_l2_cache.c Paul Walmsley 2019-10-17 195 static int __init sifive_l2_init(void)
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 196 {
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 197 struct device_node *np;
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 198 struct resource res;
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 199 int i, rc, intr_num;
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 200
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 201 np = of_find_matching_node(NULL, sifive_l2_ids);
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 202 if (!np)
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 203 return -ENODEV;
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 204
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 205 if (of_address_to_resource(np, 0, &res))
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 206 return -ENODEV;
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 207
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 208 l2_base = ioremap(res.start, resource_size(&res));
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 209 if (!l2_base)
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 210 return -ENOMEM;
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 211
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 212 intr_num = of_property_count_u32_elems(np, "interrupts");
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 213 if (!intr_num) {
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 214 pr_err("L2CACHE: no interrupts property\n");
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 215 return -ENODEV;
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 216 }
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 217
507308b8ccc90d3 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-12-10 218 for (i = 0; i < intr_num; i++) {
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 219 g_irq[i] = irq_of_parse_and_map(np, i);
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 220 rc = request_irq(g_irq[i], l2_int_handler, 0, "l2_ecc", NULL);
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 221 if (rc) {
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 222 pr_err("L2CACHE: Could not request IRQ %d\n", g_irq[i]);
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 223 return rc;
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 224 }
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 225 }
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 226
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 227 l2_config_read();
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 228
4a3a37331248d85 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-02-20 229 l2_cache_ops.get_priv_group = l2_get_priv_group;
4a3a37331248d85 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-02-20 230 riscv_set_cacheinfo_ops(&l2_cache_ops);
4a3a37331248d85 drivers/soc/sifive/sifive_l2_cache.c Yash Shah 2020-02-20 231
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 232 #ifdef CONFIG_DEBUG_FS
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 233 setup_sifive_debug();
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 234 #endif
a967a289f169695 arch/riscv/mm/sifive_l2_cache.c Yash Shah 2019-05-06 @235 return 0;
:::::: The code at line 235 was first introduced by commit
:::::: a967a289f16969527a8a41e261695c639a69bee4 RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs
:::::: TO: Yash Shah <yash.shah(a)sifive.com>
:::::: CC: Palmer Dabbelt <palmer(a)sifive.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang...
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Olivier Moysan <olivier.moysan(a)st.com>
CC: Mark Brown <broonie(a)kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
commit: 8a262e614ef8675cfde924c6ddf873a95db0be6a ASoC: stm32: i2s: add master clock provider
date: 8 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8a262e614ef8675cfde924c6ddf873a95db0be6a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:550:2: warning: Value stored to 'priv' is never read [clang-analyzer-deadcode.DeadStores]
priv = dev->dev_private;
^ ~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:550:2: note: Value stored to 'priv' is never read
priv = dev->dev_private;
^ ~~~~~~~~~~~~~~~~
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1 warning generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1 warning generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1 warning generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
drivers/mtd/nand/raw/r852.c:593:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(buf, data);
^~~~~~
drivers/mtd/nand/raw/r852.c:593:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(buf, data);
^~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
sound/soc/kirkwood/kirkwood-i2s.c:322:2: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
value = readl(priv->io + KIRKWOOD_RECCTL);
^
sound/soc/kirkwood/kirkwood-i2s.c:322:2: note: Value stored to 'value' is never read
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
>> sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(p, "_mclk");
^~~~~~
sound/soc/stm/stm32_i2s.c:434:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(p, "_mclk");
^~~~~~
sound/soc/stm/stm32_i2s.c:455:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = i2s->pdev;
^~~~ ~~~~~~~~~
sound/soc/stm/stm32_i2s.c:455:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = i2s->pdev;
^~~~ ~~~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
sound/soc/codecs/rt700.c:127:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = regmap_read(rt700->regmap, reg, &jack_status);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/rt700.c:127:3: note: Value stored to 'ret' is never read
ret = regmap_read(rt700->regmap, reg, &jack_status);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
sound/soc/codecs/rt711.c:95:2: warning: Value stored to 'dev' is never read [clang-analyzer-deadcode.DeadStores]
dev = regmap_get_device(regmap);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/rt711.c:95:2: note: Value stored to 'dev' is never read
dev = regmap_get_device(regmap);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1 warning generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
drivers/media/platform/davinci/vpbe.c:631:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = -ENOMEM;
^ ~~~~~~~
drivers/media/platform/davinci/vpbe.c:631:4: note: Value stored to 'err' is never read
err = -ENOMEM;
^ ~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (16 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
vim +434 sound/soc/stm/stm32_i2s.c
8a262e614ef8675 Olivier Moysan 2021-02-05 406
8a262e614ef8675 Olivier Moysan 2021-02-05 407 static int stm32_i2s_add_mclk_provider(struct stm32_i2s_data *i2s)
8a262e614ef8675 Olivier Moysan 2021-02-05 408 {
8a262e614ef8675 Olivier Moysan 2021-02-05 409 struct clk_hw *hw;
8a262e614ef8675 Olivier Moysan 2021-02-05 410 struct stm32_i2smclk_data *mclk;
8a262e614ef8675 Olivier Moysan 2021-02-05 411 struct device *dev = &i2s->pdev->dev;
8a262e614ef8675 Olivier Moysan 2021-02-05 412 const char *pname = __clk_get_name(i2s->i2sclk);
8a262e614ef8675 Olivier Moysan 2021-02-05 413 char *mclk_name, *p, *s = (char *)pname;
8a262e614ef8675 Olivier Moysan 2021-02-05 414 int ret, i = 0;
8a262e614ef8675 Olivier Moysan 2021-02-05 415
8a262e614ef8675 Olivier Moysan 2021-02-05 416 mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL);
8a262e614ef8675 Olivier Moysan 2021-02-05 417 if (!mclk)
8a262e614ef8675 Olivier Moysan 2021-02-05 418 return -ENOMEM;
8a262e614ef8675 Olivier Moysan 2021-02-05 419
8a262e614ef8675 Olivier Moysan 2021-02-05 420 mclk_name = devm_kcalloc(dev, sizeof(char),
8a262e614ef8675 Olivier Moysan 2021-02-05 421 STM32_I2S_NAME_LEN, GFP_KERNEL);
8a262e614ef8675 Olivier Moysan 2021-02-05 422 if (!mclk_name)
8a262e614ef8675 Olivier Moysan 2021-02-05 423 return -ENOMEM;
8a262e614ef8675 Olivier Moysan 2021-02-05 424
8a262e614ef8675 Olivier Moysan 2021-02-05 425 /*
8a262e614ef8675 Olivier Moysan 2021-02-05 426 * Forge mclk clock name from parent clock name and suffix.
8a262e614ef8675 Olivier Moysan 2021-02-05 427 * String after "_" char is stripped in parent name.
8a262e614ef8675 Olivier Moysan 2021-02-05 428 */
8a262e614ef8675 Olivier Moysan 2021-02-05 429 p = mclk_name;
8a262e614ef8675 Olivier Moysan 2021-02-05 430 while (*s && *s != '_' && (i < (STM32_I2S_NAME_LEN - 7))) {
8a262e614ef8675 Olivier Moysan 2021-02-05 431 *p++ = *s++;
8a262e614ef8675 Olivier Moysan 2021-02-05 432 i++;
8a262e614ef8675 Olivier Moysan 2021-02-05 433 }
8a262e614ef8675 Olivier Moysan 2021-02-05 @434 strcat(p, "_mclk");
8a262e614ef8675 Olivier Moysan 2021-02-05 435
8a262e614ef8675 Olivier Moysan 2021-02-05 436 mclk->hw.init = CLK_HW_INIT(mclk_name, pname, &mclk_ops, 0);
8a262e614ef8675 Olivier Moysan 2021-02-05 437 mclk->i2s_data = i2s;
8a262e614ef8675 Olivier Moysan 2021-02-05 438 hw = &mclk->hw;
8a262e614ef8675 Olivier Moysan 2021-02-05 439
8a262e614ef8675 Olivier Moysan 2021-02-05 440 dev_dbg(dev, "Register master clock %s\n", mclk_name);
8a262e614ef8675 Olivier Moysan 2021-02-05 441 ret = devm_clk_hw_register(&i2s->pdev->dev, hw);
8a262e614ef8675 Olivier Moysan 2021-02-05 442 if (ret) {
8a262e614ef8675 Olivier Moysan 2021-02-05 443 dev_err(dev, "mclk register fails with error %d\n", ret);
8a262e614ef8675 Olivier Moysan 2021-02-05 444 return ret;
8a262e614ef8675 Olivier Moysan 2021-02-05 445 }
8a262e614ef8675 Olivier Moysan 2021-02-05 446 i2s->i2smclk = hw->clk;
8a262e614ef8675 Olivier Moysan 2021-02-05 447
8a262e614ef8675 Olivier Moysan 2021-02-05 448 /* register mclk provider */
8a262e614ef8675 Olivier Moysan 2021-02-05 449 return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
8a262e614ef8675 Olivier Moysan 2021-02-05 450 }
8a262e614ef8675 Olivier Moysan 2021-02-05 451
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
drivers/iio/adc/max1027.c:412:14: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Miquel Raynal <miquel.raynal(a)bootlin.com>
CC: 0day robot <lkp(a)intel.com>
tree: https://github.com/0day-ci/linux/commits/Miquel-Raynal/Bring-external-tri...
head: 82403933ab13283e98041a4c285420988531362c
commit: 1e80dcadd79f6dec7346dc596fbafd508ea2844e iio: adc: max1027: Minimize the number of converted channels
date: 8 days ago
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: riscv-randconfig-c006-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/1e80dcadd79f6dec7346dc596fbafd508...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miquel-Raynal/Bring-external-triggers-support-to-MAX1027-like-ADCs/20210922-131741
git checkout 1e80dcadd79f6dec7346dc596fbafd508ea2844e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
struct adis16130_state {
~~~~~~~^~~~~~~~~~~~~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/dac/ad5770r.c:133:8: warning: Excessive padding in 'struct ad5770r_state' (86 padding bytes, where 22 is optimal).
Optimal fields order:
transf_buf,
internal_ref,
external_res,
spi,
regmap,
vref_reg,
gpio_reset,
vref,
ch_pwr_down,
output_mode,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct ad5770r_state {
~~~~~~~^~~~~~~~~~~~~~~
drivers/iio/dac/ad5770r.c:133:8: note: Excessive padding in 'struct ad5770r_state' (86 padding bytes, where 22 is optimal). Optimal fields order: transf_buf, internal_ref, external_res, spi, regmap, vref_reg, gpio_reset, vref, ch_pwr_down, output_mode, consider reordering the fields or adding explicit padding members
struct ad5770r_state {
~~~~~~~^~~~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/dac/ad7303.c:37:8: warning: Excessive padding in 'struct ad7303_state' (98 padding bytes, where 34 is optimal).
Optimal fields order:
data,
config,
spi,
vdd_reg,
vref_reg,
lock,
dac_cache,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct ad7303_state {
~~~~~~~^~~~~~~~~~~~~~
drivers/iio/dac/ad7303.c:37:8: note: Excessive padding in 'struct ad7303_state' (98 padding bytes, where 34 is optimal). Optimal fields order: data, config, spi, vdd_reg, vref_reg, lock, dac_cache, consider reordering the fields or adding explicit padding members
struct ad7303_state {
~~~~~~~^~~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/dac/ad8801.c:21:8: warning: Excessive padding in 'struct ad8801_state' (98 padding bytes, where 34 is optimal).
Optimal fields order:
data,
dac_cache,
spi,
vrefh_mv,
vrefl_mv,
vrefh_reg,
vrefl_reg,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct ad8801_state {
~~~~~~~^~~~~~~~~~~~~~
drivers/iio/dac/ad8801.c:21:8: note: Excessive padding in 'struct ad8801_state' (98 padding bytes, where 34 is optimal). Optimal fields order: data, dac_cache, spi, vrefh_mv, vrefl_mv, vrefh_reg, vrefl_reg, consider reordering the fields or adding explicit padding members
struct ad8801_state {
~~~~~~~^~~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
drivers/iio/adc/max1027.c:265:8: warning: Excessive padding in 'struct max1027_state' (99 padding bytes, where 35 is optimal).
Optimal fields order:
reg,
info,
spi,
trig,
buffer,
lock,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct max1027_state {
~~~~~~~^~~~~~~~~~~~~~~
drivers/iio/adc/max1027.c:265:8: note: Excessive padding in 'struct max1027_state' (99 padding bytes, where 35 is optimal). Optimal fields order: reg, info, spi, trig, buffer, lock, consider reordering the fields or adding explicit padding members
struct max1027_state {
~~~~~~~^~~~~~~~~~~~~~~
>> drivers/iio/adc/max1027.c:412:14: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
^
drivers/iio/adc/max1027.c:38:32: note: expanded from macro 'MAX1027_CHAN'
#define MAX1027_CHAN(n) ((n) << 3)
~~~ ^
drivers/iio/adc/max1027.c:399:6: note: Assuming 'state' is true
if (state) {
^~~~~
drivers/iio/adc/max1027.c:399:2: note: Taking true branch
if (state) {
^
drivers/iio/adc/max1027.c:404:7: note: Assuming 'ret' is >= 0
if (ret < 0)
^~~~~~~
drivers/iio/adc/max1027.c:404:3: note: Taking false branch
if (ret < 0)
^
drivers/iio/adc/max1027.c:412:14: note: The result of the left shift is undefined because the left operand is negative
st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
^
drivers/iio/adc/max1027.c:38:32: note: expanded from macro 'MAX1027_CHAN'
#define MAX1027_CHAN(n) ((n) << 3)
~~~ ^
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/adc/max11100.c:31:8: warning: Excessive padding in 'struct max11100_state' (117 padding bytes, where 53 is optimal).
Optimal fields order:
buffer,
vref_reg,
spi,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct max11100_state {
~~~~~~~^~~~~~~~~~~~~~~~
drivers/iio/adc/max11100.c:31:8: note: Excessive padding in 'struct max11100_state' (117 padding bytes, where 53 is optimal). Optimal fields order: buffer, vref_reg, spi, consider reordering the fields or adding explicit padding members
struct max11100_state {
~~~~~~~^~~~~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
drivers/iio/adc/max1241.c:22:8: warning: Excessive padding in 'struct max1241' (98 padding bytes, where 34 is optimal).
Optimal fields order:
data,
spi,
vdd,
vref,
shutdown,
lock,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct max1241 {
~~~~~~~^~~~~~~~~
drivers/iio/adc/max1241.c:22:8: note: Excessive padding in 'struct max1241' (98 padding bytes, where 34 is optimal). Optimal fields order: data, spi, vdd, vref, shutdown, lock, consider reordering the fields or adding explicit padding members
struct max1241 {
~~~~~~~^~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:589:11: warning: Value stored to 'hi_sidd' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
uint16_t hi_sidd = smu_data->power_tune_table.BapmVddCBaseLeakageHiSidd;
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:589:11: note: Value stored to 'hi_sidd' during its initialization is never read
uint16_t hi_sidd = smu_data->power_tune_table.BapmVddCBaseLeakageHiSidd;
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:590:11: warning: Value stored to 'lo_sidd' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
uint16_t lo_sidd = smu_data->power_tune_table.BapmVddCBaseLeakageLoSidd;
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:590:11: note: Value stored to 'lo_sidd' during its initialization is never read
uint16_t lo_sidd = smu_data->power_tune_table.BapmVddCBaseLeakageLoSidd;
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:967:2: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores]
result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:967:2: note: Value stored to 'result' is never read
result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:1592:3: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores]
result = 0;
^ ~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:1592:3: note: Value stored to 'result' is never read
result = 0;
^ ~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:1600:3: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores]
result = 0;
^ ~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:1600:3: note: Value stored to 'result' is never read
result = 0;
^ ~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:1868:3: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores]
result = smu7_read_smc_sram_dword(hwmgr,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:1868:3: note: Value stored to 'result' is never read
result = smu7_read_smc_sram_dword(hwmgr,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 10 warnings (10 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
vim +412 drivers/iio/adc/max1027.c
fc167f62483325 Philippe Reynes 2014-06-14 392
fc167f62483325 Philippe Reynes 2014-06-14 393 static int max1027_set_trigger_state(struct iio_trigger *trig, bool state)
fc167f62483325 Philippe Reynes 2014-06-14 394 {
fc167f62483325 Philippe Reynes 2014-06-14 395 struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
fc167f62483325 Philippe Reynes 2014-06-14 396 struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14 397 int ret;
fc167f62483325 Philippe Reynes 2014-06-14 398
fc167f62483325 Philippe Reynes 2014-06-14 399 if (state) {
fc167f62483325 Philippe Reynes 2014-06-14 400 /* Start acquisition on cnvst */
fc167f62483325 Philippe Reynes 2014-06-14 401 st->reg = MAX1027_SETUP_REG | MAX1027_CKS_MODE0 |
fc167f62483325 Philippe Reynes 2014-06-14 402 MAX1027_REF_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14 403 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 404 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 405 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 406
1e80dcadd79f6d Miquel Raynal 2021-09-21 407 /*
1e80dcadd79f6d Miquel Raynal 2021-09-21 408 * Scan from chan 0 to the highest requested channel.
1e80dcadd79f6d Miquel Raynal 2021-09-21 409 * Include temperature on demand.
1e80dcadd79f6d Miquel Raynal 2021-09-21 410 */
1e80dcadd79f6d Miquel Raynal 2021-09-21 411 st->reg = MAX1027_CONV_REG | MAX1027_SCAN_0_N;
1e80dcadd79f6d Miquel Raynal 2021-09-21 @412 st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
1e80dcadd79f6d Miquel Raynal 2021-09-21 413 if (*indio_dev->active_scan_mask & MAX1X27_SCAN_MASK_TEMP)
1e80dcadd79f6d Miquel Raynal 2021-09-21 414 st->reg |= MAX1027_TEMP;
1e80dcadd79f6d Miquel Raynal 2021-09-21 415
fc167f62483325 Philippe Reynes 2014-06-14 416 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 417 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 418 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 419 } else {
fc167f62483325 Philippe Reynes 2014-06-14 420 /* Start acquisition on conversion register write */
fc167f62483325 Philippe Reynes 2014-06-14 421 st->reg = MAX1027_SETUP_REG | MAX1027_CKS_MODE2 |
fc167f62483325 Philippe Reynes 2014-06-14 422 MAX1027_REF_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14 423 ret = spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14 424 if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14 425 return ret;
fc167f62483325 Philippe Reynes 2014-06-14 426 }
fc167f62483325 Philippe Reynes 2014-06-14 427
fc167f62483325 Philippe Reynes 2014-06-14 428 return 0;
fc167f62483325 Philippe Reynes 2014-06-14 429 }
fc167f62483325 Philippe Reynes 2014-06-14 430
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
[net-next:master 14/41] net/core/dev.c:6917:11: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: netdev(a)vger.kernel.org
TO: Jakub Kicinski <kuba(a)kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head: 1e0083bd0777e4a418a6710d9ee04b979cdbe5cc
commit: 719c571970109b0d0af24745d31b202affc9365f [14/41] net: make napi_disable() symmetric with enable
:::::: branch date: 33 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-c007-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit...
git remote add net-next https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
git fetch --no-tags net-next master
git checkout 719c571970109b0d0af24745d31b202affc9365f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/netdevice.h:3048:2: note: Calling 'skb_gro_frag0_invalidate'
skb_gro_frag0_invalidate(skb);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:3038:2: note: Null pointer value stored to field 'frag0'
NAPI_GRO_CB(skb)->frag0 = NULL;
^
include/linux/netdevice.h:2590:26: note: expanded from macro 'NAPI_GRO_CB'
#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
^
include/linux/netdevice.h:3048:2: note: Returning from 'skb_gro_frag0_invalidate'
skb_gro_frag0_invalidate(skb);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/dev.c:6301:9: note: Returning from 'skb_gro_header_slow'
eth = skb_gro_header_slow(skb, hlen, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/dev.c:6302:16: note: Assuming 'eth' is non-null
if (unlikely(!eth)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/core/dev.c:6302:3: note: Taking false branch
if (unlikely(!eth)) {
^
net/core/dev.c:6314:2: note: Calling '__skb_pull'
__skb_pull(skb, hlen);
^~~~~~~~~~~~~~~~~~~~~
include/linux/skbuff.h:2329:9: note: Assuming field 'len' is >= field 'data_len'
BUG_ON(skb->len < skb->data_len);
^
include/asm-generic/bug.h:65:45: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/skbuff.h:2329:2: note: Taking false branch
BUG_ON(skb->len < skb->data_len);
^
include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^
include/linux/skbuff.h:2329:2: note: Loop condition is false. Exiting loop
BUG_ON(skb->len < skb->data_len);
^
include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^
net/core/dev.c:6314:2: note: Returning from '__skb_pull'
__skb_pull(skb, hlen);
^~~~~~~~~~~~~~~~~~~~~
net/core/dev.c:6329:24: note: Returning from 'napi_frags_skb'
struct sk_buff *skb = napi_frags_skb(napi);
^~~~~~~~~~~~~~~~~~~~
net/core/dev.c:6333:37: note: Calling 'dev_gro_receive'
ret = napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/dev.c:6044:2: note: Taking true branch
if (netif_elide_gro(skb->dev))
^
net/core/dev.c:6045:3: note: Control jumps to line 6138
goto normal;
^
net/core/dev.c:6139:2: note: Control jumps to line 6124
goto pull;
^
net/core/dev.c:6125:6: note: Assuming 'grow' is > 0
if (grow > 0)
^~~~~~~~
net/core/dev.c:6125:2: note: Taking true branch
if (grow > 0)
^
net/core/dev.c:6126:3: note: Calling 'gro_pull_from_frag0'
gro_pull_from_frag0(skb, grow);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/dev.c:5996:9: note: Assuming the condition is false
BUG_ON(skb->end - skb->tail < grow);
^
include/asm-generic/bug.h:65:45: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/core/dev.c:5996:2: note: Taking false branch
BUG_ON(skb->end - skb->tail < grow);
^
include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^
net/core/dev.c:5996:2: note: Loop condition is false. Exiting loop
BUG_ON(skb->end - skb->tail < grow);
^
include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^
net/core/dev.c:5998:2: note: Null pointer passed as 2nd argument to memory copy function
memcpy(skb_tail_pointer(skb), NAPI_GRO_CB(skb)->frag0, grow);
^
>> net/core/dev.c:6917:11: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
} while (cmpxchg(&n->state, val, new) != val);
^
include/linux/atomic/atomic-instrumented.h:1790:2: note: expanded from macro 'cmpxchg'
arch_cmpxchg(__ai_ptr, __VA_ARGS__); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cmpxchg.h:149:2: note: expanded from macro 'arch_cmpxchg'
__cmpxchg(ptr, old, new, sizeof(*(ptr)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cmpxchg.h:134:2: note: expanded from macro '__cmpxchg'
__raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cmpxchg.h:89:2: note: expanded from macro '__raw_cmpxchg'
__typeof__(*(ptr)) __new = (new); \
^ ~~~~~
net/core/dev.c:6903:21: note: 'new' declared without an initial value
unsigned long val, new;
^~~
net/core/dev.c:6905:2: note: Loop condition is false. Exiting loop
might_sleep();
^
include/linux/kernel.h:132:45: note: expanded from macro 'might_sleep'
do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
^
include/linux/kernel.h:109:26: note: expanded from macro 'might_resched'
# define might_resched() do { } while (0)
^
net/core/dev.c:6905:2: note: Loop condition is false. Exiting loop
might_sleep();
^
include/linux/kernel.h:132:2: note: expanded from macro 'might_sleep'
do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
^
net/core/dev.c:6909:9: note: Left side of '||' is false
val = READ_ONCE(n->state);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
net/core/dev.c:6909:9: note: Left side of '||' is false
val = READ_ONCE(n->state);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
net/core/dev.c:6909:9: note: Left side of '||' is false
val = READ_ONCE(n->state);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
net/core/dev.c:6909:9: note: Left side of '||' is true
val = READ_ONCE(n->state);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:38: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
net/core/dev.c:6909:9: note: Taking false branch
val = READ_ONCE(n->state);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
net/core/dev.c:6909:9: note: Loop condition is false. Exiting loop
val = READ_ONCE(n->state);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
vim +6917 net/core/dev.c
d565b0a1a9b6ee Herbert Xu 2008-12-15 6900
3b47d30396bae4 Eric Dumazet 2014-11-06 6901 void napi_disable(struct napi_struct *n)
3b47d30396bae4 Eric Dumazet 2014-11-06 6902 {
719c571970109b Jakub Kicinski 2021-09-24 6903 unsigned long val, new;
719c571970109b Jakub Kicinski 2021-09-24 6904
3b47d30396bae4 Eric Dumazet 2014-11-06 6905 might_sleep();
3b47d30396bae4 Eric Dumazet 2014-11-06 6906 set_bit(NAPI_STATE_DISABLE, &n->state);
3b47d30396bae4 Eric Dumazet 2014-11-06 6907
719c571970109b Jakub Kicinski 2021-09-24 6908 do {
719c571970109b Jakub Kicinski 2021-09-24 6909 val = READ_ONCE(n->state);
719c571970109b Jakub Kicinski 2021-09-24 6910 if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
719c571970109b Jakub Kicinski 2021-09-24 6911 usleep_range(20, 200);
719c571970109b Jakub Kicinski 2021-09-24 6912 continue;
719c571970109b Jakub Kicinski 2021-09-24 6913 }
719c571970109b Jakub Kicinski 2021-09-24 6914
719c571970109b Jakub Kicinski 2021-09-24 6915 new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
719c571970109b Jakub Kicinski 2021-09-24 6916 new &= ~(NAPIF_STATE_THREADED | NAPIF_STATE_PREFER_BUSY_POLL);
719c571970109b Jakub Kicinski 2021-09-24 @6917 } while (cmpxchg(&n->state, val, new) != val);
3b47d30396bae4 Eric Dumazet 2014-11-06 6918
3b47d30396bae4 Eric Dumazet 2014-11-06 6919 hrtimer_cancel(&n->timer);
3b47d30396bae4 Eric Dumazet 2014-11-06 6920
3b47d30396bae4 Eric Dumazet 2014-11-06 6921 clear_bit(NAPI_STATE_DISABLE, &n->state);
3b47d30396bae4 Eric Dumazet 2014-11-06 6922 }
3b47d30396bae4 Eric Dumazet 2014-11-06 6923 EXPORT_SYMBOL(napi_disable);
3b47d30396bae4 Eric Dumazet 2014-11-06 6924
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
[rostedt-trace:ftrace/core 2/2] kernel/trace/pid_list.c:439:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Steven Rostedt (VMware)" <rostedt(a)goodmis.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git ftrace/core
head: c8d01c02b46e599b057d7d24d1342ae9fcf828c2
commit: c8d01c02b46e599b057d7d24d1342ae9fcf828c2 [2/2] tracing: Create a sparse bitmask for pid filtering
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: riscv-randconfig-c006-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/c...
git remote add rostedt-trace https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
git fetch --no-tags rostedt-trace ftrace/core
git checkout c8d01c02b46e599b057d7d24d1342ae9fcf828c2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~
drivers/clk/clk-fractional-divider.c:140:2: note: Taking false branch
if (fd->approximation)
^
drivers/clk/clk-fractional-divider.c:143:3: note: Calling 'clk_fractional_divider_general_approximation'
clk_fractional_divider_general_approximation(hw, rate, parent_rate, &m, &n);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clk/clk-fractional-divider.c:109:38: note: Left side of '&&' is false
struct clk_fractional_divider *fd = to_clk_fd(hw);
^
include/linux/clk-provider.h:1027:24: note: expanded from macro 'to_clk_fd'
#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/clk/clk-fractional-divider.c:109:38: note: Taking false branch
struct clk_fractional_divider *fd = to_clk_fd(hw);
^
include/linux/clk-provider.h:1027:24: note: expanded from macro 'to_clk_fd'
#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/clk/clk-fractional-divider.c:109:38: note: Loop condition is false. Exiting loop
struct clk_fractional_divider *fd = to_clk_fd(hw);
^
include/linux/clk-provider.h:1027:24: note: expanded from macro 'to_clk_fd'
#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
drivers/clk/clk-fractional-divider.c:118:6: note: Assuming the condition is true
if (fd->flags & CLK_FRAC_DIVIDER_POWER_OF_TWO_PS) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clk/clk-fractional-divider.c:118:2: note: Taking true branch
if (fd->flags & CLK_FRAC_DIVIDER_POWER_OF_TWO_PS) {
^
drivers/clk/clk-fractional-divider.c:121:7: note: Assuming 'scale' is > field 'nwidth'
if (scale > fd->nwidth)
^~~~~~~~~~~~~~~~~~
drivers/clk/clk-fractional-divider.c:121:3: note: Taking true branch
if (scale > fd->nwidth)
^
drivers/clk/clk-fractional-divider.c:126:32: note: The result of the right shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long'
GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0),
^
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:36:11: note: expanded from macro '__GENMASK'
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
kernel/trace/trace_printk.c:77:5: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(fmt, *iter);
^~~~~~
kernel/trace/trace_printk.c:77:5: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(fmt, *iter);
^~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
>> kernel/trace/pid_list.c:439:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
if (upper) {
^~~~~
kernel/trace/pid_list.c:396:36: note: Left side of '&&' is false
struct trace_pid_list *pid_list = container_of(iwork, struct trace_pid_list,
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
kernel/trace/pid_list.c:396:36: note: Taking false branch
struct trace_pid_list *pid_list = container_of(iwork, struct trace_pid_list,
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
kernel/trace/pid_list.c:396:36: note: Loop condition is false. Exiting loop
struct trace_pid_list *pid_list = container_of(iwork, struct trace_pid_list,
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
kernel/trace/pid_list.c:398:2: note: 'upper' declared without an initial value
union upper_chunk *upper;
^~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/pid_list.c:413:6: note: Assuming 'upper_count' is > 0
if (upper_count <= 0 && lower_count <= 0)
^~~~~~~~~~~~~~~~
kernel/trace/pid_list.c:413:23: note: Left side of '&&' is false
if (upper_count <= 0 && lower_count <= 0)
^
kernel/trace/pid_list.c:416:2: note: Loop condition is true. Entering loop body
while (upper_count-- > 0) {
^
kernel/trace/pid_list.c:420:7: note: Assuming 'chunk' is null
if (!chunk)
^~~~~~
kernel/trace/pid_list.c:420:3: note: Taking true branch
if (!chunk)
^
kernel/trace/pid_list.c:421:4: note: Execution continues on line 427
break;
^
kernel/trace/pid_list.c:427:9: note: Assuming the condition is false
while (lower_count-- > 0) {
^~~~~~~~~~~~~~~~~
kernel/trace/pid_list.c:427:2: note: Loop condition is false. Execution continues on line 438
while (lower_count-- > 0) {
^
kernel/trace/pid_list.c:439:6: note: Branch condition evaluates to a garbage value
if (upper) {
^~~~~
kernel/trace/pid_list.c:444:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
if (lower) {
^~~~~
kernel/trace/pid_list.c:396:36: note: Left side of '&&' is false
struct trace_pid_list *pid_list = container_of(iwork, struct trace_pid_list,
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
kernel/trace/pid_list.c:396:36: note: Taking false branch
struct trace_pid_list *pid_list = container_of(iwork, struct trace_pid_list,
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
vim +439 kernel/trace/pid_list.c
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 393)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 394) static void pid_list_refill_irq(struct irq_work *iwork)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 395) {
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 396) struct trace_pid_list *pid_list = container_of(iwork, struct trace_pid_list,
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 397) refill_irqwork);
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 398) union upper_chunk *upper;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 399) union lower_chunk *lower;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 400) union upper_chunk **upper_next = &upper;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 401) union lower_chunk **lower_next = &lower;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 402) int upper_count;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 403) int lower_count;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 404) int ucnt = 0;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 405) int lcnt = 0;
eff05923d317af7 Steven Rostedt (VMware 2021-09-23 406)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 407) again:
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 408) raw_spin_lock(&pid_list->lock);
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 409) upper_count = CHUNK_ALLOC - pid_list->free_upper_chunks;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 410) lower_count = CHUNK_ALLOC - pid_list->free_lower_chunks;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 411) raw_spin_unlock(&pid_list->lock);
eff05923d317af7 Steven Rostedt (VMware 2021-09-23 412)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 413) if (upper_count <= 0 && lower_count <= 0)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 414) return;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 415)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 416) while (upper_count-- > 0) {
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 417) union upper_chunk *chunk;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 418)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 419) chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 420) if (!chunk)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 421) break;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 422) *upper_next = chunk;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 423) upper_next = &chunk->next;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 424) ucnt++;
eff05923d317af7 Steven Rostedt (VMware 2021-09-23 425) }
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 426)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 427) while (lower_count-- > 0) {
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 428) union lower_chunk *chunk;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 429)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 430) chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 431) if (!chunk)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 432) break;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 433) *lower_next = chunk;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 434) lower_next = &chunk->next;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 435) lcnt++;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 436) }
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 437)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 438) raw_spin_lock(&pid_list->lock);
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 @439) if (upper) {
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 440) *upper_next = pid_list->upper_list;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 441) pid_list->upper_list = upper;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 442) pid_list->free_upper_chunks += ucnt;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 443) }
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 444) if (lower) {
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 445) *lower_next = pid_list->lower_list;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 446) pid_list->lower_list = lower;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 447) pid_list->free_lower_chunks += lcnt;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 448) }
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 449) raw_spin_unlock(&pid_list->lock);
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 450)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 451) /*
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 452) * On success of allocating all the chunks, both counters
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 453) * will be less than zero. If they are not, then an allocation
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 454) * failed, and we should not try again.
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 455) */
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 456) if (upper_count >= 0 || lower_count >= 0)
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 457) return;
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 458) /*
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 459) * When the locks were released, free chunks could have
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 460) * been used and allocation needs to be done again. Might as
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 461) * well allocate it now.
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 462) */
c8d01c02b46e599 Steven Rostedt (VMware 2021-09-23 463) goto again;
eff05923d317af7 Steven Rostedt (VMware 2021-09-23 464) }
eff05923d317af7 Steven Rostedt (VMware 2021-09-23 465)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
drivers/media/v4l2-core/v4l2-ioctl.c:3308:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Arnd Bergmann <arnd(a)arndb.de>
CC: Mauro Carvalho Chehab <mchehab(a)kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Hans Verkuil <hverkuil(a)xs4all.nl>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a4e6f95a891ac08bd09d62e3e6dae239b150f4c1
commit: 8dbcc3fa387c16abfc88a628cf528c439c91b332 media: v4l2: prepare compat-ioctl rework
date: 11 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 11 months ago
config: arm-randconfig-c002-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8dbcc3fa387c16abfc88a628cf528c439c91b332
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/uapi/asm-generic/ioctl.h:94:23: note: expanded from macro '_IOC_DIR'
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
^
drivers/media/v4l2-core/v4l2-ioctl.c:3275:2: note: Taking true branch
if (_IOC_DIR(cmd) != _IOC_NONE) {
^
drivers/media/v4l2-core/v4l2-ioctl.c:3276:7: note: Assuming the condition is true
if (ioc_size <= sizeof(sbuf)) {
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3276:3: note: Taking true branch
if (ioc_size <= sizeof(sbuf)) {
^
drivers/media/v4l2-core/v4l2-ioctl.c:3286:9: note: Calling 'video_get_user'
err = video_get_user((void __user *)arg, parg, cmd,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3121:6: note: Assuming the condition is false
if (!(_IOC_DIR(cmd) & _IOC_WRITE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3121:2: note: Taking false branch
if (!(_IOC_DIR(cmd) & _IOC_WRITE)) {
^
drivers/media/v4l2-core/v4l2-ioctl.c:3134:2: note: Taking false branch
if (v4l2_is_known_ioctl(real_cmd)) {
^
drivers/media/v4l2-core/v4l2-ioctl.c:3142:6: note: 'cmd' is equal to 'real_cmd'
if (cmd == real_cmd) {
^~~
drivers/media/v4l2-core/v4l2-ioctl.c:3142:2: note: Taking true branch
if (cmd == real_cmd) {
^
drivers/media/v4l2-core/v4l2-ioctl.c:3143:7: note: Calling 'copy_from_user'
if (copy_from_user(parg, (void __user *)arg, n))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uaccess.h:191:2: note: Taking true branch
if (likely(check_copy_size(to, n, false)))
^
include/linux/uaccess.h:192:7: note: Calling '_copy_from_user'
n = _copy_from_user(to, from, n);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uaccess.h:157:6: note: Left side of '&&' is true
if (!should_fail_usercopy() && likely(access_ok(from, n))) {
^
include/linux/uaccess.h:157:33: note: Assuming the condition is false
if (!should_fail_usercopy() && likely(access_ok(from, n))) {
^
include/linux/compiler.h:77:20: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uaccess.h:157:2: note: Taking false branch
if (!should_fail_usercopy() && likely(access_ok(from, n))) {
^
include/linux/uaccess.h:161:6: note: Assuming 'res' is 0
if (unlikely(res))
^
include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~
include/linux/uaccess.h:161:2: note: Taking false branch
if (unlikely(res))
^
include/linux/uaccess.h:192:7: note: Returning from '_copy_from_user'
n = _copy_from_user(to, from, n);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3143:7: note: Returning from 'copy_from_user'
if (copy_from_user(parg, (void __user *)arg, n))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3143:3: note: Taking false branch
if (copy_from_user(parg, (void __user *)arg, n))
^
drivers/media/v4l2-core/v4l2-ioctl.c:3182:7: note: 'err' is 0
if (!err && n < _IOC_SIZE(real_cmd))
^~~
drivers/media/v4l2-core/v4l2-ioctl.c:3182:6: note: Left side of '&&' is true
if (!err && n < _IOC_SIZE(real_cmd))
^
drivers/media/v4l2-core/v4l2-ioctl.c:3182:2: note: Taking false branch
if (!err && n < _IOC_SIZE(real_cmd))
^
drivers/media/v4l2-core/v4l2-ioctl.c:3184:2: note: Returning zero (loaded from 'err'), which participates in a condition later
return err;
^~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3286:9: note: Returning from 'video_get_user'
err = video_get_user((void __user *)arg, parg, cmd,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3288:7: note: 'err' is 0
if (err)
^~~
drivers/media/v4l2-core/v4l2-ioctl.c:3288:3: note: Taking false branch
if (err)
^
drivers/media/v4l2-core/v4l2-ioctl.c:3292:8: note: Calling 'check_array_args'
err = check_array_args(cmd, parg, &array_size, &user_ptr, &kernel_ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3032:2: note: Control jumps to 'case 3222820425:' at line 3071
switch (cmd) {
^
drivers/media/v4l2-core/v4l2-ioctl.c:3074:20: note: The left operand of '!=' is a garbage value
if (ctrls->count != 0) {
~~~~~~~~~~~~ ^
>> drivers/media/v4l2-core/v4l2-ioctl.c:3308:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = -EFAULT;
^ ~~~~~~~
drivers/media/v4l2-core/v4l2-ioctl.c:3308:3: note: Value stored to 'err' is never read
err = -EFAULT;
^ ~~~~~~~
Suppressed 18 warnings (18 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
fs/configfs/file.c:149:10: warning: Value stored to 'len' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
ssize_t len = min_t(size_t, count, PAGE_SIZE);
^~~
fs/configfs/file.c:149:10: note: Value stored to 'len' during its initialization is never read
ssize_t len = min_t(size_t, count, PAGE_SIZE);
^~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
Suppressed 18 warnings (18 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
fs/configfs/symlink.c:72:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(s,"../");
^~~~~~
fs/configfs/symlink.c:72:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(s,"../");
^~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/i2c/i2c-core-smbus.c:101:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
return (status < 0) ? status : data.byte;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:98:11: note: Calling 'i2c_smbus_xfer'
status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:539:6: note: Assuming 'res' is not equal to 0
if (res)
^~~
drivers/i2c/i2c-core-smbus.c:539:2: note: Taking true branch
if (res)
^
drivers/i2c/i2c-core-smbus.c:540:3: note: Returning without writing to 'data->byte'
return res;
^
drivers/i2c/i2c-core-smbus.c:98:11: note: Returning from 'i2c_smbus_xfer'
status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:101:10: note: Assuming 'status' is >= 0
return (status < 0) ? status : data.byte;
^~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:101:9: note: '?' condition is false
return (status < 0) ? status : data.byte;
^
drivers/i2c/i2c-core-smbus.c:101:2: note: Undefined or garbage value returned to caller
return (status < 0) ? status : data.byte;
vim +/err +3308 drivers/media/v4l2-core/v4l2-ioctl.c
c8ef1a6076bfb98 drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2019-12-16 3257
fc0a80798576f80 drivers/media/video/v4l2-ioctl.c Laurent Pinchart 2010-07-12 3258 long
c8ef1a6076bfb98 drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2019-12-16 3259 video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
fc0a80798576f80 drivers/media/video/v4l2-ioctl.c Laurent Pinchart 2010-07-12 3260 v4l2_kioctl func)
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3261 {
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3262 char sbuf[128];
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3263 void *mbuf = NULL;
1d94aa369da073a drivers/media/video/v4l2-ioctl.c Hans Verkuil 2010-04-06 3264 void *parg = (void *)arg;
069b747931f13ed drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-12-30 3265 long err = -EINVAL;
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3266 bool has_array_args;
043f77edae8bd50 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2017-05-10 3267 bool always_copy = false;
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3268 size_t array_size = 0;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3269 void __user *user_ptr = NULL;
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3270 void **kernel_ptr = NULL;
c8ef1a6076bfb98 drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2019-12-16 3271 unsigned int cmd = video_translate_cmd(orig_cmd);
f8a695c4b43d02c drivers/media/v4l2-core/v4l2-ioctl.c Mauro Carvalho Chehab 2018-03-26 3272 const size_t ioc_size = _IOC_SIZE(cmd);
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3273
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3274 /* Copy arguments into temp kernel buffer */
337f9d205972bfe drivers/media/video/v4l2-ioctl.c Trent Piepho 2009-03-04 3275 if (_IOC_DIR(cmd) != _IOC_NONE) {
f8a695c4b43d02c drivers/media/v4l2-core/v4l2-ioctl.c Mauro Carvalho Chehab 2018-03-26 3276 if (ioc_size <= sizeof(sbuf)) {
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3277 parg = sbuf;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3278 } else {
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3279 /* too big to allocate from stack */
f8a695c4b43d02c drivers/media/v4l2-core/v4l2-ioctl.c Mauro Carvalho Chehab 2018-03-26 3280 mbuf = kvmalloc(ioc_size, GFP_KERNEL);
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3281 if (NULL == mbuf)
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3282 return -ENOMEM;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3283 parg = mbuf;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3284 }
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3285
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3286 err = video_get_user((void __user *)arg, parg, cmd,
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3287 orig_cmd, &always_copy);
c8ef1a6076bfb98 drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2019-12-16 3288 if (err)
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3289 goto out;
1dc8b65c944e5cf drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-01-08 3290 }
19c96e4b7d3c800 drivers/media/video/v4l2-ioctl.c Trent Piepho 2009-03-04 3291
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3292 err = check_array_args(cmd, parg, &array_size, &user_ptr, &kernel_ptr);
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3293 if (err < 0)
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3294 goto out;
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3295 has_array_args = err;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3296
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3297 if (has_array_args) {
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3298 /*
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3299 * When adding new types of array args, make sure that the
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3300 * parent argument to ioctl (which contains the pointer to the
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3301 * array) fits into sbuf (so that mbuf will still remain
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3302 * unused up to here).
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3303 */
758d90e161382c1 drivers/media/v4l2-core/v4l2-ioctl.c Tomasz Figa 2017-06-19 3304 mbuf = kvmalloc(array_size, GFP_KERNEL);
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3305 err = -ENOMEM;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3306 if (NULL == mbuf)
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3307 goto out_array_args;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 @3308 err = -EFAULT;
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3309 if (in_compat_syscall())
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3310 err = v4l2_compat_get_array_args(file, mbuf, user_ptr,
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3311 array_size, orig_cmd,
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3312 parg);
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3313 else
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3314 err = copy_from_user(mbuf, user_ptr, array_size) ?
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3315 -EFAULT : 0;
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3316 if (err)
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3317 goto out_array_args;
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3318 *kernel_ptr = mbuf;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3319 }
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3320
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3321 /* Handles IOCTL */
fc0a80798576f80 drivers/media/video/v4l2-ioctl.c Laurent Pinchart 2010-07-12 3322 err = func(file, cmd, parg);
181a4a2d5a0a7b4 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2018-01-30 3323 if (err == -ENOTTY || err == -ENOIOCTLCMD) {
02bbb814d8db7b6 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2012-02-08 3324 err = -ENOTTY;
181a4a2d5a0a7b4 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2018-01-30 3325 goto out;
181a4a2d5a0a7b4 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2018-01-30 3326 }
181a4a2d5a0a7b4 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2018-01-30 3327
aa32f4c0bcce7da drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2013-12-16 3328 if (err == 0) {
aa32f4c0bcce7da drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2013-12-16 3329 if (cmd == VIDIOC_DQBUF)
aa32f4c0bcce7da drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2013-12-16 3330 trace_v4l2_dqbuf(video_devdata(file)->minor, parg);
aa32f4c0bcce7da drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2013-12-16 3331 else if (cmd == VIDIOC_QBUF)
aa32f4c0bcce7da drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2013-12-16 3332 trace_v4l2_qbuf(video_devdata(file)->minor, parg);
aa32f4c0bcce7da drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2013-12-16 3333 }
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3334
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3335 if (has_array_args) {
ba2d35c14b6fc55 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2014-03-17 3336 *kernel_ptr = (void __force *)user_ptr;
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3337 if (in_compat_syscall()) {
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3338 int put_err;
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3339
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3340 put_err = v4l2_compat_put_array_args(file, user_ptr, mbuf,
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3341 array_size, orig_cmd,
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3342 parg);
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3343 if (put_err)
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3344 err = put_err;
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3345 } else if (copy_to_user(user_ptr, mbuf, array_size)) {
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3346 err = -EFAULT;
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3347 }
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3348 goto out_array_args;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3349 }
043f77edae8bd50 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2017-05-10 3350 /*
043f77edae8bd50 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2017-05-10 3351 * Some ioctls can return an error, but still have valid
043f77edae8bd50 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2017-05-10 3352 * results that must be returned.
043f77edae8bd50 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2017-05-10 3353 */
043f77edae8bd50 drivers/media/v4l2-core/v4l2-ioctl.c Hans Verkuil 2017-05-10 3354 if (err < 0 && !always_copy)
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3355 goto out;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3356
d14e6d76ebf740f drivers/media/video/v4l2-ioctl.c Pawel Osciak 2010-12-23 3357 out_array_args:
8dbcc3fa387c16a drivers/media/v4l2-core/v4l2-ioctl.c Arnd Bergmann 2020-10-30 3358 if (video_put_user((void __user *)arg, parg, cmd, orig_cmd))
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3359 err = -EFAULT;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3360 out:
758d90e161382c1 drivers/media/v4l2-core/v4l2-ioctl.c Tomasz Figa 2017-06-19 3361 kvfree(mbuf);
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3362 return err;
35ea11ff84719b1 drivers/media/video/v4l2-ioctl.c Hans Verkuil 2008-07-20 3363 }
fc0a80798576f80 drivers/media/video/v4l2-ioctl.c Laurent Pinchart 2010-07-12 3364
:::::: The code at line 3308 was first introduced by commit
:::::: 35ea11ff84719b1bfab2909903a9640a86552fd1 V4L/DVB (8430): videodev: move some functions from v4l2-dev.h to v4l2-common.h or v4l2-ioctl.h
:::::: TO: Hans Verkuil <hverkuil(a)xs4all.nl>
:::::: CC: Mauro Carvalho Chehab <mchehab(a)infradead.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks