* block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]
@ 2022-04-11 4:36 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-11 4:36 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 18575 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jan Kara <jack@suse.cz>
CC: Jens Axboe <axboe@kernel.dk>
CC: "Michal Koutný" <mkoutny@suse.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ce522ba9ef7e2d9fb22a39eb3371c0c64e2a433e
commit: 76f1df88bbc2f984eb0418cc90de0a8384e63604 bfq: Limit number of requests consumed by each cgroup
date: 4 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 4 months ago
config: riscv-randconfig-c006-20220405 (https://download.01.org/0day-ci/archive/20220411/202204111231.sGGMzRWT-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
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/torvalds/linux.git/commit/?id=76f1df88bbc2f984eb0418cc90de0a8384e63604
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 76f1df88bbc2f984eb0418cc90de0a8384e63604
# save the config file 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@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
arch/riscv/include/asm/bug.h:79:29: note: expanded from macro '__WARN_FLAGS'
#define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))
^
arch/riscv/include/asm/bug.h:53:32: note: expanded from macro '__BUG_FLAGS'
#define __BUG_FLAGS(flags) \
^
drivers/spi/spi-nxp-fspi.c:876:2: note: Calling 'nxp_fspi_prepare_lut'
nxp_fspi_prepare_lut(f, op);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:538:6: note: Assuming field 'nbytes' is 0
if (op->addr.nbytes) {
^~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:538:2: note: Taking false branch
if (op->addr.nbytes) {
^
drivers/spi/spi-nxp-fspi.c:546:6: note: Assuming field 'nbytes' is not equal to 0
if (op->dummy.nbytes) {
^~~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:546:2: note: Taking true branch
if (op->dummy.nbytes) {
^
drivers/spi/spi-nxp-fspi.c:547:25: note: The result of the left shift is undefined because the left operand is negative
lutval[lutidx / 2] |= LUT_DEF(lutidx, LUT_DUMMY,
^
drivers/spi/spi-nxp-fspi.c:311:36: note: expanded from macro 'LUT_DEF'
((((ins) << INSTR_SHIFT) | ((pad) << PAD_SHIFT) | \
~~~~~ ^
drivers/spi/spi-nxp-fspi.c:560:25: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
lutval[lutidx / 2] |= LUT_DEF(lutidx,
^
drivers/spi/spi-nxp-fspi.c:311:36: note: expanded from macro 'LUT_DEF'
((((ins) << INSTR_SHIFT) | ((pad) << PAD_SHIFT) | \
^
drivers/spi/spi-nxp-fspi.c:872:2: note: Assuming 'err' is not equal to 0
WARN_ON(err);
^
include/asm-generic/bug.h:121:23: note: expanded from macro 'WARN_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:872:2: note: Taking true branch
WARN_ON(err);
^
include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
if (unlikely(__ret_warn_on)) \
^
drivers/spi/spi-nxp-fspi.c:872:2: note: Loop condition is false. Exiting loop
WARN_ON(err);
^
include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON'
__WARN(); \
^
include/asm-generic/bug.h:96:19: note: expanded from macro '__WARN'
#define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
^
arch/riscv/include/asm/bug.h:79:29: note: expanded from macro '__WARN_FLAGS'
#define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))
^
arch/riscv/include/asm/bug.h:53:32: note: expanded from macro '__BUG_FLAGS'
#define __BUG_FLAGS(flags) \
^
drivers/spi/spi-nxp-fspi.c:876:2: note: Calling 'nxp_fspi_prepare_lut'
nxp_fspi_prepare_lut(f, op);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:538:6: note: Assuming field 'nbytes' is 0
if (op->addr.nbytes) {
^~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:538:2: note: Taking false branch
if (op->addr.nbytes) {
^
drivers/spi/spi-nxp-fspi.c:546:6: note: Assuming field 'nbytes' is 0
if (op->dummy.nbytes) {
^~~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:546:2: note: Taking false branch
if (op->dummy.nbytes) {
^
drivers/spi/spi-nxp-fspi.c:559:6: note: Assuming field 'nbytes' is not equal to 0
if (op->data.nbytes) {
^~~~~~~~~~~~~~~
drivers/spi/spi-nxp-fspi.c:559:2: note: Taking true branch
if (op->data.nbytes) {
^
drivers/spi/spi-nxp-fspi.c:561:12: note: Assuming field 'dir' is not equal to SPI_MEM_DATA_IN
op->data.dir == SPI_MEM_DATA_IN ?
^
drivers/spi/spi-nxp-fspi.c:311:6: note: expanded from macro 'LUT_DEF'
((((ins) << INSTR_SHIFT) | ((pad) << PAD_SHIFT) | \
^~~
drivers/spi/spi-nxp-fspi.c:561:12: note: '?' condition is false
op->data.dir == SPI_MEM_DATA_IN ?
^
drivers/spi/spi-nxp-fspi.c:560:25: note: The result of the left shift is undefined because the left operand is negative
lutval[lutidx / 2] |= LUT_DEF(lutidx,
^
drivers/spi/spi-nxp-fspi.c:311:36: note: expanded from macro 'LUT_DEF'
((((ins) << INSTR_SHIFT) | ((pad) << PAD_SHIFT) | \
~~~~~ ^
Suppressed 10 warnings (3 in non-user code, 7 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.
13 warnings generated.
>> block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]
limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
^
include/linux/math.h:92:26: note: expanded from macro 'DIV_ROUND_CLOSEST'
(((__x) + ((__d) / 2)) / (__d)) : \
^
block/bfq-iosched.c:672:27: note: Assuming 'bic' is non-null
struct bfq_queue *bfqq = bic ? bic_to_bfqq(bic, op_is_sync(op)) : NULL;
^~~
block/bfq-iosched.c:672:27: note: '?' condition is true
block/bfq-iosched.c:677:6: note: Assuming the condition is true
if (op_is_sync(op) && !op_is_write(op)) {
^~~~~~~~~~~~~~
block/bfq-iosched.c:677:6: note: Left side of '&&' is true
block/bfq-iosched.c:677:24: note: Assuming the condition is true
if (op_is_sync(op) && !op_is_write(op)) {
^~~~~~~~~~~~~~~~
block/bfq-iosched.c:677:2: note: Taking true branch
if (op_is_sync(op) && !op_is_write(op)) {
^
block/bfq-iosched.c:689:6: note: Assuming 'bfqq' is non-null
if (bfqq && bfqq_request_over_limit(bfqq, limit))
^~~~
block/bfq-iosched.c:689:6: note: Left side of '&&' is true
block/bfq-iosched.c:689:14: note: Calling 'bfqq_request_over_limit'
if (bfqq && bfqq_request_over_limit(bfqq, limit))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:583:6: note: Assuming field 'on_st_or_in_serv' is true
if (!entity->on_st_or_in_serv)
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:583:2: note: Taking false branch
if (!entity->on_st_or_in_serv)
^
block/bfq-iosched.c:588:6: note: Assuming 'depth' is <= BFQ_LIMIT_INLINE_DEPTH
if (depth > BFQ_LIMIT_INLINE_DEPTH) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:588:2: note: Taking false branch
if (depth > BFQ_LIMIT_INLINE_DEPTH) {
^
block/bfq-iosched.c:598:2: note: Loop condition is true. Entering loop body
for_each_entity(entity) {
^
block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
for (; entity ; entity = entity->parent)
^
block/bfq-iosched.c:604:7: note: Assuming field 'on_st_or_in_serv' is true
if (!entity->on_st_or_in_serv)
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:604:3: note: Taking false branch
if (!entity->on_st_or_in_serv)
^
block/bfq-iosched.c:607:20: note: Assuming 'level' is < 'depth'
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
block/bfq-iosched.c:607:7: note: Taking false branch
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
block/bfq-iosched.c:607:3: note: Taking false branch
if (WARN_ON_ONCE(level >= depth))
^
block/bfq-iosched.c:598:2: note: Loop condition is false. Execution continues on line 611
for_each_entity(entity) {
^
block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
for (; entity ; entity = entity->parent)
^
block/bfq-iosched.c:611:15: note: Assuming 'level' is equal to 'depth'
WARN_ON_ONCE(level != depth);
^
include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
block/bfq-iosched.c:611:2: note: Taking false branch
WARN_ON_ONCE(level != depth);
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
block/bfq-iosched.c:612:2: note: Loop condition is true. Entering loop body
for (level--; level >= 0; level--) {
^
block/bfq-iosched.c:614:7: note: 'level' is <= 0
if (level > 0) {
^~~~~
block/bfq-iosched.c:614:3: note: Taking false branch
if (level > 0) {
^
block/bfq-iosched.c:625:4: note: The value 0 is assigned to 'wsum'
wsum = 0;
^~~~~~~~
block/bfq-iosched.c:626:16: note: Assuming 'i' is > 'class_idx'
for (i = 0; i <= class_idx; i++) {
^~~~~~~~~~~~~~
block/bfq-iosched.c:626:4: note: Loop condition is false. Execution continues on line 631
for (i = 0; i <= class_idx; i++) {
vim +631 block/bfq-iosched.c
76f1df88bbc2f9 Jan Kara 2021-11-25 569
76f1df88bbc2f9 Jan Kara 2021-11-25 570 #ifdef CONFIG_BFQ_GROUP_IOSCHED
76f1df88bbc2f9 Jan Kara 2021-11-25 571 static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25 572 {
76f1df88bbc2f9 Jan Kara 2021-11-25 573 struct bfq_data *bfqd = bfqq->bfqd;
76f1df88bbc2f9 Jan Kara 2021-11-25 574 struct bfq_entity *entity = &bfqq->entity;
76f1df88bbc2f9 Jan Kara 2021-11-25 575 struct bfq_entity *inline_entities[BFQ_LIMIT_INLINE_DEPTH];
76f1df88bbc2f9 Jan Kara 2021-11-25 576 struct bfq_entity **entities = inline_entities;
76f1df88bbc2f9 Jan Kara 2021-11-25 577 int depth, level;
76f1df88bbc2f9 Jan Kara 2021-11-25 578 int class_idx = bfqq->ioprio_class - 1;
76f1df88bbc2f9 Jan Kara 2021-11-25 579 struct bfq_sched_data *sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25 580 unsigned long wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 581 bool ret = false;
76f1df88bbc2f9 Jan Kara 2021-11-25 582
76f1df88bbc2f9 Jan Kara 2021-11-25 583 if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25 584 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 585
76f1df88bbc2f9 Jan Kara 2021-11-25 586 /* +1 for bfqq entity, root cgroup not included */
76f1df88bbc2f9 Jan Kara 2021-11-25 587 depth = bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup->level + 1;
76f1df88bbc2f9 Jan Kara 2021-11-25 588 if (depth > BFQ_LIMIT_INLINE_DEPTH) {
76f1df88bbc2f9 Jan Kara 2021-11-25 589 entities = kmalloc_array(depth, sizeof(*entities), GFP_NOIO);
76f1df88bbc2f9 Jan Kara 2021-11-25 590 if (!entities)
76f1df88bbc2f9 Jan Kara 2021-11-25 591 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 592 }
76f1df88bbc2f9 Jan Kara 2021-11-25 593
76f1df88bbc2f9 Jan Kara 2021-11-25 594 spin_lock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25 595 sched_data = entity->sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25 596 /* Gather our ancestors as we need to traverse them in reverse order */
76f1df88bbc2f9 Jan Kara 2021-11-25 597 level = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25 598 for_each_entity(entity) {
76f1df88bbc2f9 Jan Kara 2021-11-25 599 /*
76f1df88bbc2f9 Jan Kara 2021-11-25 600 * If at some level entity is not even active, allow request
76f1df88bbc2f9 Jan Kara 2021-11-25 601 * queueing so that BFQ knows there's work to do and activate
76f1df88bbc2f9 Jan Kara 2021-11-25 602 * entities.
76f1df88bbc2f9 Jan Kara 2021-11-25 603 */
76f1df88bbc2f9 Jan Kara 2021-11-25 604 if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25 605 goto out;
76f1df88bbc2f9 Jan Kara 2021-11-25 606 /* Uh, more parents than cgroup subsystem thinks? */
76f1df88bbc2f9 Jan Kara 2021-11-25 607 if (WARN_ON_ONCE(level >= depth))
76f1df88bbc2f9 Jan Kara 2021-11-25 608 break;
76f1df88bbc2f9 Jan Kara 2021-11-25 609 entities[level++] = entity;
76f1df88bbc2f9 Jan Kara 2021-11-25 610 }
76f1df88bbc2f9 Jan Kara 2021-11-25 611 WARN_ON_ONCE(level != depth);
76f1df88bbc2f9 Jan Kara 2021-11-25 612 for (level--; level >= 0; level--) {
76f1df88bbc2f9 Jan Kara 2021-11-25 613 entity = entities[level];
76f1df88bbc2f9 Jan Kara 2021-11-25 614 if (level > 0) {
76f1df88bbc2f9 Jan Kara 2021-11-25 615 wsum = bfq_entity_service_tree(entity)->wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 616 } else {
76f1df88bbc2f9 Jan Kara 2021-11-25 617 int i;
76f1df88bbc2f9 Jan Kara 2021-11-25 618 /*
76f1df88bbc2f9 Jan Kara 2021-11-25 619 * For bfqq itself we take into account service trees
76f1df88bbc2f9 Jan Kara 2021-11-25 620 * of all higher priority classes and multiply their
76f1df88bbc2f9 Jan Kara 2021-11-25 621 * weights so that low prio queue from higher class
76f1df88bbc2f9 Jan Kara 2021-11-25 622 * gets more requests than high prio queue from lower
76f1df88bbc2f9 Jan Kara 2021-11-25 623 * class.
76f1df88bbc2f9 Jan Kara 2021-11-25 624 */
76f1df88bbc2f9 Jan Kara 2021-11-25 625 wsum = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25 626 for (i = 0; i <= class_idx; i++) {
76f1df88bbc2f9 Jan Kara 2021-11-25 627 wsum = wsum * IOPRIO_BE_NR +
76f1df88bbc2f9 Jan Kara 2021-11-25 628 sched_data->service_tree[i].wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 629 }
76f1df88bbc2f9 Jan Kara 2021-11-25 630 }
76f1df88bbc2f9 Jan Kara 2021-11-25 @631 limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
76f1df88bbc2f9 Jan Kara 2021-11-25 632 if (entity->allocated >= limit) {
76f1df88bbc2f9 Jan Kara 2021-11-25 633 bfq_log_bfqq(bfqq->bfqd, bfqq,
76f1df88bbc2f9 Jan Kara 2021-11-25 634 "too many requests: allocated %d limit %d level %d",
76f1df88bbc2f9 Jan Kara 2021-11-25 635 entity->allocated, limit, level);
76f1df88bbc2f9 Jan Kara 2021-11-25 636 ret = true;
76f1df88bbc2f9 Jan Kara 2021-11-25 637 break;
76f1df88bbc2f9 Jan Kara 2021-11-25 638 }
76f1df88bbc2f9 Jan Kara 2021-11-25 639 }
76f1df88bbc2f9 Jan Kara 2021-11-25 640 out:
76f1df88bbc2f9 Jan Kara 2021-11-25 641 spin_unlock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25 642 if (entities != inline_entities)
76f1df88bbc2f9 Jan Kara 2021-11-25 643 kfree(entities);
76f1df88bbc2f9 Jan Kara 2021-11-25 644 return ret;
76f1df88bbc2f9 Jan Kara 2021-11-25 645 }
76f1df88bbc2f9 Jan Kara 2021-11-25 646 #else
76f1df88bbc2f9 Jan Kara 2021-11-25 647 static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25 648 {
76f1df88bbc2f9 Jan Kara 2021-11-25 649 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 650 }
76f1df88bbc2f9 Jan Kara 2021-11-25 651 #endif
76f1df88bbc2f9 Jan Kara 2021-11-25 652
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 3+ messages in thread
* block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]
@ 2022-07-03 14:47 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-07-03 14:47 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 19178 bytes --]
::::::
:::::: Manual check reason: "low confidence static check warning: block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]"
::::::
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jan Kara <jack@suse.cz>
CC: Jens Axboe <axboe@kernel.dk>
CC: "Michal Koutný" <mkoutny@suse.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 69cb6c6556ad89620547318439d6be8bb1629a5a
commit: 76f1df88bbc2f984eb0418cc90de0a8384e63604 bfq: Limit number of requests consumed by each cgroup
date: 7 months ago
:::::: branch date: 20 hours ago
:::::: commit date: 7 months ago
config: arm-randconfig-c002-20220625 (https://download.01.org/0day-ci/archive/20220703/202207032249.nYpcQ5V6-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 42a7ddb428c999229491b0effbb1a4059149fba8)
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/?id=76f1df88bbc2f984eb0418cc90de0a8384e63604
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 76f1df88bbc2f984eb0418cc90de0a8384e63604
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
if (bio_add_page(bio, page, length, 0) < length) {
^
fs/mpage.c:641:2: note: Assuming the condition is true
BUG_ON(PageWriteback(page));
^
include/asm-generic/bug.h:65:36: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~
fs/mpage.c:641:2: note: Taking false branch
BUG_ON(PageWriteback(page));
^
include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^
fs/mpage.c:641:2: note: Loop condition is false. Exiting loop
BUG_ON(PageWriteback(page));
^
include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^
fs/mpage.c:644:6: note: 'boundary' is 0
if (boundary || (first_unmapped != blocks_per_page)) {
^~~~~~~~
fs/mpage.c:644:6: note: Left side of '||' is false
fs/mpage.c:644:19: note: 'first_unmapped' is equal to 'blocks_per_page'
if (boundary || (first_unmapped != blocks_per_page)) {
^~~~~~~~~~~~~~
fs/mpage.c:644:2: note: Taking false branch
if (boundary || (first_unmapped != blocks_per_page)) {
^
fs/mpage.c:651:26: note: Assigned value is garbage or undefined
mpd->last_block_in_bio = blocks[blocks_per_page - 1];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
8 warnings generated.
drivers/gpu/drm/gud/gud_pipe.c:596:33: warning: Access to field 'width' results in a dereference of a null pointer (loaded from variable 'fb') [clang-analyzer-core.NullDereference]
drm_rect_init(&damage, 0, 0, fb->width, fb->height);
^~
drivers/gpu/drm/gud/gud_pipe.c:566:2: note: 'fb' initialized here
struct drm_framebuffer *fb = state->fb;
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:571:6: note: Assuming field 'mode_changed' is false
if (crtc->state->mode_changed || !crtc->state->enable) {
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:571:6: note: Left side of '||' is false
drivers/gpu/drm/gud/gud_pipe.c:571:35: note: Assuming field 'enable' is true
if (crtc->state->mode_changed || !crtc->state->enable) {
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:571:2: note: Taking false branch
if (crtc->state->mode_changed || !crtc->state->enable) {
^
drivers/gpu/drm/gud/gud_pipe.c:582:6: note: Assuming the condition is false
if (!drm_dev_enter(drm, &idx))
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:582:2: note: Taking false branch
if (!drm_dev_enter(drm, &idx))
^
drivers/gpu/drm/gud/gud_pipe.c:585:6: note: Assuming field 'fb' is non-null
if (!old_state->fb)
^~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:585:2: note: Taking false branch
if (!old_state->fb)
^
drivers/gpu/drm/gud/gud_pipe.c:588:6: note: Assuming 'fb' is null
if (fb && (crtc->state->mode_changed || crtc->state->connectors_changed))
^~
drivers/gpu/drm/gud/gud_pipe.c:588:9: note: Left side of '&&' is false
if (fb && (crtc->state->mode_changed || crtc->state->connectors_changed))
^
drivers/gpu/drm/gud/gud_pipe.c:591:6: note: Assuming field 'active_changed' is false
if (crtc->state->active_changed)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:591:2: note: Taking false branch
if (crtc->state->active_changed)
^
drivers/gpu/drm/gud/gud_pipe.c:594:6: note: Assuming the condition is true
if (drm_atomic_helper_damage_merged(old_state, state, &damage)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:594:2: note: Taking true branch
if (drm_atomic_helper_damage_merged(old_state, state, &damage)) {
^
drivers/gpu/drm/gud/gud_pipe.c:595:7: note: Assuming the condition is true
if (gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/gud/gud_pipe.c:595:3: note: Taking true branch
if (gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE)
^
drivers/gpu/drm/gud/gud_pipe.c:596:33: note: Access to field 'width' results in a dereference of a null pointer (loaded from variable 'fb')
drm_rect_init(&damage, 0, 0, fb->width, fb->height);
^~
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.
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.
>> block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]
limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
^
include/linux/math.h:92:26: note: expanded from macro 'DIV_ROUND_CLOSEST'
(((__x) + ((__d) / 2)) / (__d)) : \
^
block/bfq-iosched.c:672:27: note: Assuming 'bic' is non-null
struct bfq_queue *bfqq = bic ? bic_to_bfqq(bic, op_is_sync(op)) : NULL;
^~~
block/bfq-iosched.c:672:27: note: '?' condition is true
block/bfq-iosched.c:677:6: note: Assuming the condition is true
if (op_is_sync(op) && !op_is_write(op)) {
^~~~~~~~~~~~~~
block/bfq-iosched.c:677:6: note: Left side of '&&' is true
block/bfq-iosched.c:677:24: note: Assuming the condition is true
if (op_is_sync(op) && !op_is_write(op)) {
^~~~~~~~~~~~~~~~
block/bfq-iosched.c:677:2: note: Taking true branch
if (op_is_sync(op) && !op_is_write(op)) {
^
block/bfq-iosched.c:689:6: note: Assuming 'bfqq' is non-null
if (bfqq && bfqq_request_over_limit(bfqq, limit))
^~~~
block/bfq-iosched.c:689:6: note: Left side of '&&' is true
block/bfq-iosched.c:689:14: note: Calling 'bfqq_request_over_limit'
if (bfqq && bfqq_request_over_limit(bfqq, limit))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:583:6: note: Assuming field 'on_st_or_in_serv' is true
if (!entity->on_st_or_in_serv)
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:583:2: note: Taking false branch
if (!entity->on_st_or_in_serv)
^
block/bfq-iosched.c:588:6: note: Assuming 'depth' is <= BFQ_LIMIT_INLINE_DEPTH
if (depth > BFQ_LIMIT_INLINE_DEPTH) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:588:2: note: Taking false branch
if (depth > BFQ_LIMIT_INLINE_DEPTH) {
^
block/bfq-iosched.c:598:2: note: Loop condition is true. Entering loop body
for_each_entity(entity) {
^
block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
for (; entity ; entity = entity->parent)
^
block/bfq-iosched.c:604:7: note: Assuming field 'on_st_or_in_serv' is true
if (!entity->on_st_or_in_serv)
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:604:3: note: Taking false branch
if (!entity->on_st_or_in_serv)
^
block/bfq-iosched.c:607:20: note: Assuming 'level' is < 'depth'
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:146:18: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^~~~~~~~~
include/linux/once_lite.h:15:27: note: expanded from macro 'DO_ONCE_LITE_IF'
bool __ret_do_once = !!(condition); \
^~~~~~~~~
block/bfq-iosched.c:607:7: note: '__ret_do_once' is false
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/once_lite.h:17:16: note: expanded from macro 'DO_ONCE_LITE_IF'
if (unlikely(__ret_do_once && !__already_done)) { \
^~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
block/bfq-iosched.c:607:7: note: Left side of '&&' is false
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^
include/linux/once_lite.h:17:30: note: expanded from macro 'DO_ONCE_LITE_IF'
if (unlikely(__ret_do_once && !__already_done)) { \
^
block/bfq-iosched.c:607:7: note: Taking false branch
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^
include/linux/once_lite.h:17:3: note: expanded from macro 'DO_ONCE_LITE_IF'
if (unlikely(__ret_do_once && !__already_done)) { \
^
block/bfq-iosched.c:607:3: note: Taking false branch
if (WARN_ON_ONCE(level >= depth))
^
block/bfq-iosched.c:598:2: note: Loop condition is false. Execution continues on line 611
for_each_entity(entity) {
^
block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
for (; entity ; entity = entity->parent)
^
block/bfq-iosched.c:611:15: note: Assuming 'level' is equal to 'depth'
WARN_ON_ONCE(level != depth);
vim +631 block/bfq-iosched.c
76f1df88bbc2f9 Jan Kara 2021-11-25 569
76f1df88bbc2f9 Jan Kara 2021-11-25 570 #ifdef CONFIG_BFQ_GROUP_IOSCHED
76f1df88bbc2f9 Jan Kara 2021-11-25 571 static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25 572 {
76f1df88bbc2f9 Jan Kara 2021-11-25 573 struct bfq_data *bfqd = bfqq->bfqd;
76f1df88bbc2f9 Jan Kara 2021-11-25 574 struct bfq_entity *entity = &bfqq->entity;
76f1df88bbc2f9 Jan Kara 2021-11-25 575 struct bfq_entity *inline_entities[BFQ_LIMIT_INLINE_DEPTH];
76f1df88bbc2f9 Jan Kara 2021-11-25 576 struct bfq_entity **entities = inline_entities;
76f1df88bbc2f9 Jan Kara 2021-11-25 577 int depth, level;
76f1df88bbc2f9 Jan Kara 2021-11-25 578 int class_idx = bfqq->ioprio_class - 1;
76f1df88bbc2f9 Jan Kara 2021-11-25 579 struct bfq_sched_data *sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25 580 unsigned long wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 581 bool ret = false;
76f1df88bbc2f9 Jan Kara 2021-11-25 582
76f1df88bbc2f9 Jan Kara 2021-11-25 583 if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25 584 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 585
76f1df88bbc2f9 Jan Kara 2021-11-25 586 /* +1 for bfqq entity, root cgroup not included */
76f1df88bbc2f9 Jan Kara 2021-11-25 587 depth = bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup->level + 1;
76f1df88bbc2f9 Jan Kara 2021-11-25 588 if (depth > BFQ_LIMIT_INLINE_DEPTH) {
76f1df88bbc2f9 Jan Kara 2021-11-25 589 entities = kmalloc_array(depth, sizeof(*entities), GFP_NOIO);
76f1df88bbc2f9 Jan Kara 2021-11-25 590 if (!entities)
76f1df88bbc2f9 Jan Kara 2021-11-25 591 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 592 }
76f1df88bbc2f9 Jan Kara 2021-11-25 593
76f1df88bbc2f9 Jan Kara 2021-11-25 594 spin_lock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25 595 sched_data = entity->sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25 596 /* Gather our ancestors as we need to traverse them in reverse order */
76f1df88bbc2f9 Jan Kara 2021-11-25 597 level = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25 598 for_each_entity(entity) {
76f1df88bbc2f9 Jan Kara 2021-11-25 599 /*
76f1df88bbc2f9 Jan Kara 2021-11-25 600 * If at some level entity is not even active, allow request
76f1df88bbc2f9 Jan Kara 2021-11-25 601 * queueing so that BFQ knows there's work to do and activate
76f1df88bbc2f9 Jan Kara 2021-11-25 602 * entities.
76f1df88bbc2f9 Jan Kara 2021-11-25 603 */
76f1df88bbc2f9 Jan Kara 2021-11-25 604 if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25 605 goto out;
76f1df88bbc2f9 Jan Kara 2021-11-25 606 /* Uh, more parents than cgroup subsystem thinks? */
76f1df88bbc2f9 Jan Kara 2021-11-25 607 if (WARN_ON_ONCE(level >= depth))
76f1df88bbc2f9 Jan Kara 2021-11-25 608 break;
76f1df88bbc2f9 Jan Kara 2021-11-25 609 entities[level++] = entity;
76f1df88bbc2f9 Jan Kara 2021-11-25 610 }
76f1df88bbc2f9 Jan Kara 2021-11-25 611 WARN_ON_ONCE(level != depth);
76f1df88bbc2f9 Jan Kara 2021-11-25 612 for (level--; level >= 0; level--) {
76f1df88bbc2f9 Jan Kara 2021-11-25 613 entity = entities[level];
76f1df88bbc2f9 Jan Kara 2021-11-25 614 if (level > 0) {
76f1df88bbc2f9 Jan Kara 2021-11-25 615 wsum = bfq_entity_service_tree(entity)->wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 616 } else {
76f1df88bbc2f9 Jan Kara 2021-11-25 617 int i;
76f1df88bbc2f9 Jan Kara 2021-11-25 618 /*
76f1df88bbc2f9 Jan Kara 2021-11-25 619 * For bfqq itself we take into account service trees
76f1df88bbc2f9 Jan Kara 2021-11-25 620 * of all higher priority classes and multiply their
76f1df88bbc2f9 Jan Kara 2021-11-25 621 * weights so that low prio queue from higher class
76f1df88bbc2f9 Jan Kara 2021-11-25 622 * gets more requests than high prio queue from lower
76f1df88bbc2f9 Jan Kara 2021-11-25 623 * class.
76f1df88bbc2f9 Jan Kara 2021-11-25 624 */
76f1df88bbc2f9 Jan Kara 2021-11-25 625 wsum = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25 626 for (i = 0; i <= class_idx; i++) {
76f1df88bbc2f9 Jan Kara 2021-11-25 627 wsum = wsum * IOPRIO_BE_NR +
76f1df88bbc2f9 Jan Kara 2021-11-25 628 sched_data->service_tree[i].wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 629 }
76f1df88bbc2f9 Jan Kara 2021-11-25 630 }
76f1df88bbc2f9 Jan Kara 2021-11-25 @631 limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
76f1df88bbc2f9 Jan Kara 2021-11-25 632 if (entity->allocated >= limit) {
76f1df88bbc2f9 Jan Kara 2021-11-25 633 bfq_log_bfqq(bfqq->bfqd, bfqq,
76f1df88bbc2f9 Jan Kara 2021-11-25 634 "too many requests: allocated %d limit %d level %d",
76f1df88bbc2f9 Jan Kara 2021-11-25 635 entity->allocated, limit, level);
76f1df88bbc2f9 Jan Kara 2021-11-25 636 ret = true;
76f1df88bbc2f9 Jan Kara 2021-11-25 637 break;
76f1df88bbc2f9 Jan Kara 2021-11-25 638 }
76f1df88bbc2f9 Jan Kara 2021-11-25 639 }
76f1df88bbc2f9 Jan Kara 2021-11-25 640 out:
76f1df88bbc2f9 Jan Kara 2021-11-25 641 spin_unlock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25 642 if (entities != inline_entities)
76f1df88bbc2f9 Jan Kara 2021-11-25 643 kfree(entities);
76f1df88bbc2f9 Jan Kara 2021-11-25 644 return ret;
76f1df88bbc2f9 Jan Kara 2021-11-25 645 }
76f1df88bbc2f9 Jan Kara 2021-11-25 646 #else
76f1df88bbc2f9 Jan Kara 2021-11-25 647 static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25 648 {
76f1df88bbc2f9 Jan Kara 2021-11-25 649 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 650 }
76f1df88bbc2f9 Jan Kara 2021-11-25 651 #endif
76f1df88bbc2f9 Jan Kara 2021-11-25 652
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 3+ messages in thread
* block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]
@ 2022-03-10 12:50 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-10 12:50 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 18628 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jan Kara <jack@suse.cz>
CC: Jens Axboe <axboe@kernel.dk>
CC: "Michal Koutný" <mkoutny@suse.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3bf7edc84a9eb4007dd9a0cb8878a7e1d5ec6a3b
commit: 76f1df88bbc2f984eb0418cc90de0a8384e63604 bfq: Limit number of requests consumed by each cgroup
date: 3 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 3 months ago
config: riscv-randconfig-c006-20220309 (https://download.01.org/0day-ci/archive/20220310/202203102046.9lMaqgME-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
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/torvalds/linux.git/commit/?id=76f1df88bbc2f984eb0418cc90de0a8384e63604
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 76f1df88bbc2f984eb0418cc90de0a8384e63604
# save the config file 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@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~
drivers/i2c/i2c-core-smbus.c:541:2: note: Taking true branch
if (res)
^
drivers/i2c/i2c-core-smbus.c:542:3: note: Returning without writing to 'data->byte'
return res;
^
drivers/i2c/i2c-core-smbus.c:141:11: note: Returning from 'i2c_smbus_xfer'
status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:144:10: note: Assuming 'status' is >= 0
return (status < 0) ? status : data.byte;
^~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:144:9: note: '?' condition is false
return (status < 0) ? status : data.byte;
^
drivers/i2c/i2c-core-smbus.c:144:2: note: Undefined or garbage value returned to caller
return (status < 0) ? status : data.byte;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:184:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
return (status < 0) ? status : data.word;
^
drivers/i2c/i2c-core-smbus.c:645:6: note: Assuming 'length' is <= I2C_SMBUS_BLOCK_MAX
if (length > I2C_SMBUS_BLOCK_MAX)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:645:2: note: Taking false branch
if (length > I2C_SMBUS_BLOCK_MAX)
^
drivers/i2c/i2c-core-smbus.c:648:2: note: Taking false branch
if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK))
^
drivers/i2c/i2c-core-smbus.c:651:2: note: Taking false branch
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA))
^
drivers/i2c/i2c-core-smbus.c:654:2: note: Taking true branch
if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) {
^
drivers/i2c/i2c-core-smbus.c:655:10: note: Assuming the condition is true
while ((i + 2) <= length) {
^~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:655:3: note: Loop condition is true. Entering loop body
while ((i + 2) <= length) {
^
drivers/i2c/i2c-core-smbus.c:657:8: note: 'status' is >= 0
if (status < 0)
^~~~~~
drivers/i2c/i2c-core-smbus.c:657:4: note: Taking false branch
if (status < 0)
^
drivers/i2c/i2c-core-smbus.c:655:10: note: Assuming the condition is true
while ((i + 2) <= length) {
^~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:655:3: note: Loop condition is true. Entering loop body
while ((i + 2) <= length) {
^
drivers/i2c/i2c-core-smbus.c:657:8: note: 'status' is >= 0
if (status < 0)
^~~~~~
drivers/i2c/i2c-core-smbus.c:657:4: note: Taking false branch
if (status < 0)
^
drivers/i2c/i2c-core-smbus.c:655:10: note: Assuming the condition is true
while ((i + 2) <= length) {
^~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:655:3: note: Loop condition is true. Entering loop body
while ((i + 2) <= length) {
^
drivers/i2c/i2c-core-smbus.c:656:13: note: Calling 'i2c_smbus_read_word_data'
status = i2c_smbus_read_word_data(client, command + i);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:181:11: note: Calling 'i2c_smbus_xfer'
status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:541:6: note: Assuming 'res' is not equal to 0
if (res)
^~~
drivers/i2c/i2c-core-smbus.c:541:2: note: Taking true branch
if (res)
^
drivers/i2c/i2c-core-smbus.c:542:3: note: Returning without writing to 'data->word'
return res;
^
drivers/i2c/i2c-core-smbus.c:181:11: note: Returning from 'i2c_smbus_xfer'
status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:184:10: note: Assuming 'status' is >= 0
return (status < 0) ? status : data.word;
^~~~~~~~~~
drivers/i2c/i2c-core-smbus.c:184:9: note: '?' condition is false
return (status < 0) ? status : data.word;
^
drivers/i2c/i2c-core-smbus.c:184:2: note: Undefined or garbage value returned to caller
return (status < 0) ? status : data.word;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 13 warnings (6 in non-user code, 7 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.
14 warnings generated.
Suppressed 14 warnings (7 in non-user code, 7 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.
19 warnings generated.
>> block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero]
limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
^
include/linux/math.h:92:26: note: expanded from macro 'DIV_ROUND_CLOSEST'
(((__x) + ((__d) / 2)) / (__d)) : \
^
block/bfq-iosched.c:672:27: note: Assuming 'bic' is non-null
struct bfq_queue *bfqq = bic ? bic_to_bfqq(bic, op_is_sync(op)) : NULL;
^~~
block/bfq-iosched.c:672:27: note: '?' condition is true
block/bfq-iosched.c:677:6: note: Assuming the condition is true
if (op_is_sync(op) && !op_is_write(op)) {
^~~~~~~~~~~~~~
block/bfq-iosched.c:677:6: note: Left side of '&&' is true
block/bfq-iosched.c:677:24: note: Assuming the condition is true
if (op_is_sync(op) && !op_is_write(op)) {
^~~~~~~~~~~~~~~~
block/bfq-iosched.c:677:2: note: Taking true branch
if (op_is_sync(op) && !op_is_write(op)) {
^
block/bfq-iosched.c:689:6: note: Assuming 'bfqq' is non-null
if (bfqq && bfqq_request_over_limit(bfqq, limit))
^~~~
block/bfq-iosched.c:689:6: note: Left side of '&&' is true
block/bfq-iosched.c:689:14: note: Calling 'bfqq_request_over_limit'
if (bfqq && bfqq_request_over_limit(bfqq, limit))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:583:6: note: Assuming field 'on_st_or_in_serv' is true
if (!entity->on_st_or_in_serv)
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:583:2: note: Taking false branch
if (!entity->on_st_or_in_serv)
^
block/bfq-iosched.c:588:6: note: Assuming 'depth' is <= BFQ_LIMIT_INLINE_DEPTH
if (depth > BFQ_LIMIT_INLINE_DEPTH) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:588:2: note: Taking false branch
if (depth > BFQ_LIMIT_INLINE_DEPTH) {
^
block/bfq-iosched.c:598:2: note: Loop condition is true. Entering loop body
for_each_entity(entity) {
^
block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
for (; entity ; entity = entity->parent)
^
block/bfq-iosched.c:604:7: note: Assuming field 'on_st_or_in_serv' is true
if (!entity->on_st_or_in_serv)
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-iosched.c:604:3: note: Taking false branch
if (!entity->on_st_or_in_serv)
^
block/bfq-iosched.c:607:20: note: Assuming 'level' is < 'depth'
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
block/bfq-iosched.c:607:7: note: Taking false branch
if (WARN_ON_ONCE(level >= depth))
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
block/bfq-iosched.c:607:3: note: Taking false branch
if (WARN_ON_ONCE(level >= depth))
^
block/bfq-iosched.c:598:2: note: Loop condition is false. Execution continues on line 611
for_each_entity(entity) {
^
block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
for (; entity ; entity = entity->parent)
^
block/bfq-iosched.c:611:15: note: Assuming 'level' is equal to 'depth'
WARN_ON_ONCE(level != depth);
^
include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
block/bfq-iosched.c:611:2: note: Taking false branch
WARN_ON_ONCE(level != depth);
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
block/bfq-iosched.c:612:2: note: Loop condition is true. Entering loop body
for (level--; level >= 0; level--) {
^
block/bfq-iosched.c:614:7: note: 'level' is <= 0
if (level > 0) {
^~~~~
block/bfq-iosched.c:614:3: note: Taking false branch
if (level > 0) {
^
block/bfq-iosched.c:625:4: note: The value 0 is assigned to 'wsum'
wsum = 0;
^~~~~~~~
block/bfq-iosched.c:626:16: note: Assuming 'i' is > 'class_idx'
for (i = 0; i <= class_idx; i++) {
^~~~~~~~~~~~~~
block/bfq-iosched.c:626:4: note: Loop condition is false. Execution continues on line 631
for (i = 0; i <= class_idx; i++) {
vim +631 block/bfq-iosched.c
76f1df88bbc2f9 Jan Kara 2021-11-25 569
76f1df88bbc2f9 Jan Kara 2021-11-25 570 #ifdef CONFIG_BFQ_GROUP_IOSCHED
76f1df88bbc2f9 Jan Kara 2021-11-25 571 static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25 572 {
76f1df88bbc2f9 Jan Kara 2021-11-25 573 struct bfq_data *bfqd = bfqq->bfqd;
76f1df88bbc2f9 Jan Kara 2021-11-25 574 struct bfq_entity *entity = &bfqq->entity;
76f1df88bbc2f9 Jan Kara 2021-11-25 575 struct bfq_entity *inline_entities[BFQ_LIMIT_INLINE_DEPTH];
76f1df88bbc2f9 Jan Kara 2021-11-25 576 struct bfq_entity **entities = inline_entities;
76f1df88bbc2f9 Jan Kara 2021-11-25 577 int depth, level;
76f1df88bbc2f9 Jan Kara 2021-11-25 578 int class_idx = bfqq->ioprio_class - 1;
76f1df88bbc2f9 Jan Kara 2021-11-25 579 struct bfq_sched_data *sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25 580 unsigned long wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 581 bool ret = false;
76f1df88bbc2f9 Jan Kara 2021-11-25 582
76f1df88bbc2f9 Jan Kara 2021-11-25 583 if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25 584 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 585
76f1df88bbc2f9 Jan Kara 2021-11-25 586 /* +1 for bfqq entity, root cgroup not included */
76f1df88bbc2f9 Jan Kara 2021-11-25 587 depth = bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup->level + 1;
76f1df88bbc2f9 Jan Kara 2021-11-25 588 if (depth > BFQ_LIMIT_INLINE_DEPTH) {
76f1df88bbc2f9 Jan Kara 2021-11-25 589 entities = kmalloc_array(depth, sizeof(*entities), GFP_NOIO);
76f1df88bbc2f9 Jan Kara 2021-11-25 590 if (!entities)
76f1df88bbc2f9 Jan Kara 2021-11-25 591 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 592 }
76f1df88bbc2f9 Jan Kara 2021-11-25 593
76f1df88bbc2f9 Jan Kara 2021-11-25 594 spin_lock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25 595 sched_data = entity->sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25 596 /* Gather our ancestors as we need to traverse them in reverse order */
76f1df88bbc2f9 Jan Kara 2021-11-25 597 level = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25 598 for_each_entity(entity) {
76f1df88bbc2f9 Jan Kara 2021-11-25 599 /*
76f1df88bbc2f9 Jan Kara 2021-11-25 600 * If at some level entity is not even active, allow request
76f1df88bbc2f9 Jan Kara 2021-11-25 601 * queueing so that BFQ knows there's work to do and activate
76f1df88bbc2f9 Jan Kara 2021-11-25 602 * entities.
76f1df88bbc2f9 Jan Kara 2021-11-25 603 */
76f1df88bbc2f9 Jan Kara 2021-11-25 604 if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25 605 goto out;
76f1df88bbc2f9 Jan Kara 2021-11-25 606 /* Uh, more parents than cgroup subsystem thinks? */
76f1df88bbc2f9 Jan Kara 2021-11-25 607 if (WARN_ON_ONCE(level >= depth))
76f1df88bbc2f9 Jan Kara 2021-11-25 608 break;
76f1df88bbc2f9 Jan Kara 2021-11-25 609 entities[level++] = entity;
76f1df88bbc2f9 Jan Kara 2021-11-25 610 }
76f1df88bbc2f9 Jan Kara 2021-11-25 611 WARN_ON_ONCE(level != depth);
76f1df88bbc2f9 Jan Kara 2021-11-25 612 for (level--; level >= 0; level--) {
76f1df88bbc2f9 Jan Kara 2021-11-25 613 entity = entities[level];
76f1df88bbc2f9 Jan Kara 2021-11-25 614 if (level > 0) {
76f1df88bbc2f9 Jan Kara 2021-11-25 615 wsum = bfq_entity_service_tree(entity)->wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 616 } else {
76f1df88bbc2f9 Jan Kara 2021-11-25 617 int i;
76f1df88bbc2f9 Jan Kara 2021-11-25 618 /*
76f1df88bbc2f9 Jan Kara 2021-11-25 619 * For bfqq itself we take into account service trees
76f1df88bbc2f9 Jan Kara 2021-11-25 620 * of all higher priority classes and multiply their
76f1df88bbc2f9 Jan Kara 2021-11-25 621 * weights so that low prio queue from higher class
76f1df88bbc2f9 Jan Kara 2021-11-25 622 * gets more requests than high prio queue from lower
76f1df88bbc2f9 Jan Kara 2021-11-25 623 * class.
76f1df88bbc2f9 Jan Kara 2021-11-25 624 */
76f1df88bbc2f9 Jan Kara 2021-11-25 625 wsum = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25 626 for (i = 0; i <= class_idx; i++) {
76f1df88bbc2f9 Jan Kara 2021-11-25 627 wsum = wsum * IOPRIO_BE_NR +
76f1df88bbc2f9 Jan Kara 2021-11-25 628 sched_data->service_tree[i].wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25 629 }
76f1df88bbc2f9 Jan Kara 2021-11-25 630 }
76f1df88bbc2f9 Jan Kara 2021-11-25 @631 limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
76f1df88bbc2f9 Jan Kara 2021-11-25 632 if (entity->allocated >= limit) {
76f1df88bbc2f9 Jan Kara 2021-11-25 633 bfq_log_bfqq(bfqq->bfqd, bfqq,
76f1df88bbc2f9 Jan Kara 2021-11-25 634 "too many requests: allocated %d limit %d level %d",
76f1df88bbc2f9 Jan Kara 2021-11-25 635 entity->allocated, limit, level);
76f1df88bbc2f9 Jan Kara 2021-11-25 636 ret = true;
76f1df88bbc2f9 Jan Kara 2021-11-25 637 break;
76f1df88bbc2f9 Jan Kara 2021-11-25 638 }
76f1df88bbc2f9 Jan Kara 2021-11-25 639 }
76f1df88bbc2f9 Jan Kara 2021-11-25 640 out:
76f1df88bbc2f9 Jan Kara 2021-11-25 641 spin_unlock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25 642 if (entities != inline_entities)
76f1df88bbc2f9 Jan Kara 2021-11-25 643 kfree(entities);
76f1df88bbc2f9 Jan Kara 2021-11-25 644 return ret;
76f1df88bbc2f9 Jan Kara 2021-11-25 645 }
76f1df88bbc2f9 Jan Kara 2021-11-25 646 #else
76f1df88bbc2f9 Jan Kara 2021-11-25 647 static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25 648 {
76f1df88bbc2f9 Jan Kara 2021-11-25 649 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25 650 }
76f1df88bbc2f9 Jan Kara 2021-11-25 651 #endif
76f1df88bbc2f9 Jan Kara 2021-11-25 652
---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-03 14:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 4:36 block/bfq-iosched.c:631:11: warning: Division by zero [clang-analyzer-core.DivideZero] kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-07-03 14:47 kernel test robot
2022-03-10 12:50 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.