[<prev] [next>] [day] [month] [year] [list]
Message-ID: <cc33131c-f9df-6a03-7002-de5c281e6c06@intel.com>
Date: Mon, 28 Mar 2022 16:45:40 +0800
From: kernel test robot <yujie.liu@...el.com>
To: Mike Snitzer <snitzer@...nel.org>
CC: <llvm@...ts.linux.dev>, <kbuild-all@...ts.01.org>,
<dm-devel@...hat.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [device-mapper-dm:dm-5.19 126/130] drivers/md/dm.c:1471:2: warning:
Value stored to 'num_bios' is never read [clang-analyzer-deadcode.DeadStores]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git dm-5.19
head: d245a9c2bd77a40dab2f3393c4a413820dd6004d
commit: eb4cbc43473c35198e18c9b7b82e7a26fa6e5401 [126/130] dm: optimize is_abnormal_io for normal rw IO
config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220324/202203242338.J9k787ls-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
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/device-mapper/linux-dm.git/commit/?id=eb4cbc43473c35198e18c9b7b82e7a26fa6e5401
git remote add device-mapper-dm https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
git fetch --no-tags device-mapper-dm dm-5.19
git checkout eb4cbc43473c35198e18c9b7b82e7a26fa6e5401
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@...el.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> drivers/md/dm.c:1471:2: warning: Value stored to 'num_bios' is never read [clang-analyzer-deadcode.DeadStores]
num_bios = 0;
^ ~
vim +/num_bios +1471 drivers/md/dm.c
568c73a355e0b8 Mike Snitzer 2019-01-18 1462
0519c71e8d461a Mike Snitzer 2018-03-26 1463 static bool __process_abnormal_io(struct clone_info *ci, struct dm_target *ti,
0519c71e8d461a Mike Snitzer 2018-03-26 1464 int *result)
0519c71e8d461a Mike Snitzer 2018-03-26 1465 {
eb4cbc43473c35 Mike Snitzer 2022-03-22 1466 unsigned num_bios;
eb4cbc43473c35 Mike Snitzer 2022-03-22 1467
eb4cbc43473c35 Mike Snitzer 2022-03-22 1468 if (!is_abnormal_io(ci->bio))
eb4cbc43473c35 Mike Snitzer 2022-03-22 1469 return false;
0519c71e8d461a Mike Snitzer 2018-03-26 1470
eb4cbc43473c35 Mike Snitzer 2022-03-22 @1471 num_bios = 0;
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1472 switch (bio_op(ci->bio)) {
9679b5a7ec400f Mike Snitzer 2020-09-15 1473 case REQ_OP_DISCARD:
9679b5a7ec400f Mike Snitzer 2020-09-15 1474 num_bios = ti->num_discard_bios;
9679b5a7ec400f Mike Snitzer 2020-09-15 1475 break;
9679b5a7ec400f Mike Snitzer 2020-09-15 1476 case REQ_OP_SECURE_ERASE:
9679b5a7ec400f Mike Snitzer 2020-09-15 1477 num_bios = ti->num_secure_erase_bios;
9679b5a7ec400f Mike Snitzer 2020-09-15 1478 break;
9679b5a7ec400f Mike Snitzer 2020-09-15 1479 case REQ_OP_WRITE_SAME:
9679b5a7ec400f Mike Snitzer 2020-09-15 1480 num_bios = ti->num_write_same_bios;
9679b5a7ec400f Mike Snitzer 2020-09-15 1481 break;
9679b5a7ec400f Mike Snitzer 2020-09-15 1482 case REQ_OP_WRITE_ZEROES:
9679b5a7ec400f Mike Snitzer 2020-09-15 1483 num_bios = ti->num_write_zeroes_bios;
9679b5a7ec400f Mike Snitzer 2020-09-15 1484 break;
9679b5a7ec400f Mike Snitzer 2020-09-15 1485 default:
0519c71e8d461a Mike Snitzer 2018-03-26 1486 return false;
9679b5a7ec400f Mike Snitzer 2020-09-15 1487 }
num_bios will be assigned in each case.
0519c71e8d461a Mike Snitzer 2018-03-26 1488
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1489 /*
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1490 * Even though the device advertised support for this type of
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1491 * request, that does not mean every target supports it, and
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1492 * reconfiguration might also have changed that since the
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1493 * check was performed.
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1494 */
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1495 if (!num_bios)
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1496 *result = -EOPNOTSUPP;
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1497 else {
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1498 __send_changing_extent_only(ci, ti, num_bios);
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1499 *result = 0;
e6fc9f62ce6e41 Mike Snitzer 2022-02-17 1500 }
0519c71e8d461a Mike Snitzer 2018-03-26 1501 return true;
0519c71e8d461a Mike Snitzer 2018-03-26 1502 }
0519c71e8d461a Mike Snitzer 2018-03-26 1503
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists