[linux-next:master 3868/4668] fs/btrfs/verity.c:125:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
From: kernel test robot <hidden>
Date: 2021-08-02 13:04:34
Also in:
oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 8d4b477da1a807199ca60e0829357ce7aa6758d5 commit: 6875cbd232c7c516e6b2dd2b40c6eda6a552d619 [3868/4668] btrfs: initial fsverity support :::::: branch date: 17 hours ago :::::: commit date: 3 days ago config: x86_64-randconfig-c001-20210729 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c49df15c278857adecd12db6bb1cdc96885f7079) 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 x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=6875cbd232c7c516e6b2dd2b40c6eda6a552d619 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 6875cbd232c7c516e6b2dd2b40c6eda6a552d619 # 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 <redacted> clang-analyzer warnings: (new ones prefixed by >>) ^ drivers/char/agp/isoch.c:344:2: note: Assuming the condition is false for_each_pci_dev(dev) { ^ include/linux/pci.h:522:36: note: expanded from macro 'for_each_pci_dev' #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/char/agp/isoch.c:344:2: note: Loop condition is false. Execution continues on line 387 for_each_pci_dev(dev) { ^ include/linux/pci.h:522:29: note: expanded from macro 'for_each_pci_dev' #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) ^ drivers/char/agp/isoch.c:387:2: note: Loop condition is false. Execution continues on line 441 list_for_each(pos, head) { ^ include/linux/list.h:571:2: note: expanded from macro 'list_for_each' for (pos = (head)->next; pos != (head); pos = pos->next) ^ drivers/char/agp/isoch.c:441:6: note: 'isoch' is not equal to 0 if (isoch) { ^~~~~ drivers/char/agp/isoch.c:441:2: note: Taking true branch if (isoch) { ^ drivers/char/agp/isoch.c:443:7: note: Assuming 'ret' is not equal to 0 if (ret) { ^~~ drivers/char/agp/isoch.c:443:3: note: Taking true branch if (ret) { ^ drivers/char/agp/isoch.c:451:55: note: Passing the value 0 via 3rd parameter 'ndevs' agp_3_5_nonisochronous_node_enable(bridge, dev_list, ndevs); ^~~~~ drivers/char/agp/isoch.c:451:2: note: Calling 'agp_3_5_nonisochronous_node_enable' agp_3_5_nonisochronous_node_enable(bridge, dev_list, ndevs); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/char/agp/isoch.c:295:12: note: Division by zero mrq = trq / ndevs; ~~~~^~~~~~~ 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. 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. 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. 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. 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. 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. fs/nfs/direct.c:703:19: warning: Value stored to 'req' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct nfs_page *req = nfs_list_entry(hdr->pages.next); ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/nfs/direct.c:703:19: note: Value stored to 'req' during its initialization is never read struct nfs_page *req = nfs_list_entry(hdr->pages.next); ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. drivers/gpu/vga/vga_switcheroo.c:861:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = vgasr_priv.handler->switchto(client_id); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/vga/vga_switcheroo.c:861:3: note: Value stored to 'ret' is never read ret = vgasr_priv.handler->switchto(client_id); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. 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. 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. 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. 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. 6 warnings generated.
quoted
fs/btrfs/verity.c:125:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/verity.c:125:4: note: Value stored to 'ret' is never read
ret = 0;
^ ~
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.
4 warnings generated.
Suppressed 4 warnings (4 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.
fs/gfs2/bmap.c:1848:3: warning: 6th function call argument is an
uninitialized value [clang-analyzer-core.CallAndMessage]
metapointer_range(&mp, mp_h, start_list, start_aligned,
^
fs/gfs2/bmap.c:2460:7: note: Calling 'gfs2_is_stuffed'
if (!gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:22:9: note: Assuming field 'i_height' is not equal to 0
return !ip->i_height;
^~~~~~~~~~~~~
fs/gfs2/inode.h:22:2: note: Returning zero, which participates in a
condition later
return !ip->i_height;
^~~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2460:7: note: Returning from 'gfs2_is_stuffed'
if (!gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2460:2: note: Taking true branch
if (!gfs2_is_stuffed(ip)) {
^
fs/gfs2/bmap.c:2465:7: note: Assuming 'start_off' is 0
if (start_off) {
^~~~~~~~~
fs/gfs2/bmap.c:2465:3: note: Taking false branch
if (start_off) {
^
fs/gfs2/bmap.c:2475:7: note: Assuming 'end_len' is 0
if (end_len) {
^~~~~~~
fs/gfs2/bmap.c:2475:3: note: Taking false branch
if (end_len) {
^
fs/gfs2/bmap.c:2486:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/bmap.c:2486:2: note: Taking false branch
if (error)
^
fs/gfs2/bmap.c:2489:6: note: Assuming the condition is false
if (gfs2_is_jdata(ip))
^~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2489:2: note: Taking false branch
if (gfs2_is_jdata(ip))
^
fs/gfs2/bmap.c:2494:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/bmap.c:2494:2: note: Taking false branch
if (error)
^
fs/gfs2/bmap.c:2497:6: note: Calling 'gfs2_is_stuffed'
if (gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:22:14: note: Field 'i_height' is not equal to 0
return !ip->i_height;
^
fs/gfs2/inode.h:22:2: note: Returning zero, which participates in a
condition later
return !ip->i_height;
^~~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2497:6: note: Returning from 'gfs2_is_stuffed'
if (gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2497:2: note: Taking false branch
if (gfs2_is_stuffed(ip)) {
^
fs/gfs2/bmap.c:2503:6: note: Calling 'gfs2_is_jdata'
if (gfs2_is_jdata(ip)) {
^~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:27:2: note: Returning zero, which participates in a
condition later
return ip->i_diskflags & GFS2_DIF_JDATA;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2503:6: note: Returning from 'gfs2_is_jdata'
if (gfs2_is_jdata(ip)) {
^~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2503:2: note: Taking false branch
if (gfs2_is_jdata(ip)) {
^
fs/gfs2/bmap.c:2512:6: note: Assuming field 'journal_info' is null
if (current->journal_info)
^
arch/x86/include/asm/current.h:18:17: note: expanded from macro
'current'
#define current get_current()
^
fs/gfs2/bmap.c:2512:2: note: Taking false branch
if (current->journal_info)
^
fs/gfs2/bmap.c:2515:7: note: Calling 'gfs2_is_stuffed'
if (!gfs2_is_stuffed(ip))
^~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:22:9: note: Assuming field 'i_height' is not equal to 0
return !ip->i_height;
vim +/ret +125 fs/btrfs/verity.c
6875cbd232c7c5 Boris Burkov 2021-06-30 81 6875cbd232c7c5 Boris Burkov
2021-06-30 82 /*
6875cbd232c7c5 Boris Burkov 2021-06-30 83 * Drop all the items for
this inode with this key_type.
6875cbd232c7c5 Boris Burkov 2021-06-30 84 *
6875cbd232c7c5 Boris Burkov 2021-06-30 85 * @inode: inode to
drop items for
6875cbd232c7c5 Boris Burkov 2021-06-30 86 * @key_type: type of
items to drop (BTRFS_VERITY_DESC_ITEM or
6875cbd232c7c5 Boris Burkov 2021-06-30 87 *
BTRFS_VERITY_MERKLE_ITEM)
6875cbd232c7c5 Boris Burkov 2021-06-30 88 *
6875cbd232c7c5 Boris Burkov 2021-06-30 89 * Before doing a verity
enable we cleanup any existing verity items.
6875cbd232c7c5 Boris Burkov 2021-06-30 90 * This is also used to
clean up if a verity enable failed half way through.
6875cbd232c7c5 Boris Burkov 2021-06-30 91 *
6875cbd232c7c5 Boris Burkov 2021-06-30 92 * Returns number of
dropped items on success, negative error code on failure.
6875cbd232c7c5 Boris Burkov 2021-06-30 93 */
6875cbd232c7c5 Boris Burkov 2021-06-30 94 static int
drop_verity_items(struct btrfs_inode *inode, u8 key_type)
6875cbd232c7c5 Boris Burkov 2021-06-30 95 {
6875cbd232c7c5 Boris Burkov 2021-06-30 96 struct btrfs_trans_handle
*trans;
6875cbd232c7c5 Boris Burkov 2021-06-30 97 struct btrfs_root *root =
inode->root;
6875cbd232c7c5 Boris Burkov 2021-06-30 98 struct btrfs_path *path;
6875cbd232c7c5 Boris Burkov 2021-06-30 99 struct btrfs_key key;
6875cbd232c7c5 Boris Burkov 2021-06-30 100 int count = 0;
6875cbd232c7c5 Boris Burkov 2021-06-30 101 int ret;
6875cbd232c7c5 Boris Burkov 2021-06-30 102 6875cbd232c7c5 Boris Burkov
2021-06-30 103 path = btrfs_alloc_path();
6875cbd232c7c5 Boris Burkov 2021-06-30 104 if (!path)
6875cbd232c7c5 Boris Burkov 2021-06-30 105 return -ENOMEM;
6875cbd232c7c5 Boris Burkov 2021-06-30 106 6875cbd232c7c5 Boris Burkov
2021-06-30 107 while (1) {
6875cbd232c7c5 Boris Burkov 2021-06-30 108 /* 1 for the item being
dropped */
6875cbd232c7c5 Boris Burkov 2021-06-30 109 trans =
btrfs_start_transaction(root, 1);
6875cbd232c7c5 Boris Burkov 2021-06-30 110 if (IS_ERR(trans)) {
6875cbd232c7c5 Boris Burkov 2021-06-30 111 ret = PTR_ERR(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 112 goto out;
6875cbd232c7c5 Boris Burkov 2021-06-30 113 }
6875cbd232c7c5 Boris Burkov 2021-06-30 114 6875cbd232c7c5 Boris Burkov
2021-06-30 115 /*
6875cbd232c7c5 Boris Burkov 2021-06-30 116 * Walk backwards through
all the items until we find one that
6875cbd232c7c5 Boris Burkov 2021-06-30 117 * isn't from our key
type or objectid
6875cbd232c7c5 Boris Burkov 2021-06-30 118 */
6875cbd232c7c5 Boris Burkov 2021-06-30 119 key.objectid =
btrfs_ino(inode);
6875cbd232c7c5 Boris Burkov 2021-06-30 120 key.type = key_type;
6875cbd232c7c5 Boris Burkov 2021-06-30 121 key.offset = (u64)-1;
6875cbd232c7c5 Boris Burkov 2021-06-30 122 6875cbd232c7c5 Boris Burkov
2021-06-30 123 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
6875cbd232c7c5 Boris Burkov 2021-06-30 124 if (ret > 0) {
6875cbd232c7c5 Boris Burkov 2021-06-30 @125 ret = 0;
6875cbd232c7c5 Boris Burkov 2021-06-30 126 /* No more keys of this
type, we're done */
6875cbd232c7c5 Boris Burkov 2021-06-30 127 if (path->slots[0] == 0)
6875cbd232c7c5 Boris Burkov 2021-06-30 128 break;
6875cbd232c7c5 Boris Burkov 2021-06-30 129 path->slots[0]--;
6875cbd232c7c5 Boris Burkov 2021-06-30 130 } else if (ret < 0) {
6875cbd232c7c5 Boris Burkov 2021-06-30 131
btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 132 goto out;
6875cbd232c7c5 Boris Burkov 2021-06-30 133 }
6875cbd232c7c5 Boris Burkov 2021-06-30 134 6875cbd232c7c5 Boris Burkov
2021-06-30 135 btrfs_item_key_to_cpu(path->nodes[0], &key,
path->slots[0]);
6875cbd232c7c5 Boris Burkov 2021-06-30 136 6875cbd232c7c5 Boris Burkov
2021-06-30 137 /* No more keys of this type, we're done */
6875cbd232c7c5 Boris Burkov 2021-06-30 138 if (key.objectid !=
btrfs_ino(inode) || key.type != key_type)
6875cbd232c7c5 Boris Burkov 2021-06-30 139 break;
6875cbd232c7c5 Boris Burkov 2021-06-30 140 6875cbd232c7c5 Boris Burkov
2021-06-30 141 /*
6875cbd232c7c5 Boris Burkov 2021-06-30 142 * This shouldn't be a
performance sensitive function because
6875cbd232c7c5 Boris Burkov 2021-06-30 143 * it's not used as part
of truncate. If it ever becomes
6875cbd232c7c5 Boris Burkov 2021-06-30 144 * perf sensitive, change
this to walk forward and bulk delete
6875cbd232c7c5 Boris Burkov 2021-06-30 145 * items
6875cbd232c7c5 Boris Burkov 2021-06-30 146 */
6875cbd232c7c5 Boris Burkov 2021-06-30 147 ret =
btrfs_del_items(trans, root, path, path->slots[0], 1);
6875cbd232c7c5 Boris Burkov 2021-06-30 148 if (ret) {
6875cbd232c7c5 Boris Burkov 2021-06-30 149
btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 150 goto out;
6875cbd232c7c5 Boris Burkov 2021-06-30 151 }
6875cbd232c7c5 Boris Burkov 2021-06-30 152 count++;
6875cbd232c7c5 Boris Burkov 2021-06-30 153 btrfs_release_path(path);
6875cbd232c7c5 Boris Burkov 2021-06-30 154 btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 155 }
6875cbd232c7c5 Boris Burkov 2021-06-30 156 ret = count;
6875cbd232c7c5 Boris Burkov 2021-06-30 157 btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 158 out:
6875cbd232c7c5 Boris Burkov 2021-06-30 159 btrfs_free_path(path);
6875cbd232c7c5 Boris Burkov 2021-06-30 160 return ret;
6875cbd232c7c5 Boris Burkov 2021-06-30 161 }
6875cbd232c7c5 Boris Burkov 2021-06-30 162
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Attachments
- .config.gz [application/gzip] 33342 bytes
- Attached Message Part [text/plain] 150 bytes · preview