Re: [PATCH v4 2/5] btrfs: initial fsverity support
From: kernel test robot <hidden>
Date: 2021-05-06 00:10:44
Also in:
linux-fscrypt, oe-kbuild-all
Hi Boris, I love your patch! Perhaps something to improve: [auto build test WARNING on kdave/for-next] [cannot apply to v5.12 next-20210505] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Boris-Burkov/btrfs-add-compat_flags-to-btrfs_inode_item/20210506-042129 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next config: x86_64-randconfig-a014-20210505 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439) 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://github.com/0day-ci/linux/commit/f61feb554b6d2710f17960a9775bf9ba41bb2dc2 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Boris-Burkov/btrfs-add-compat_flags-to-btrfs_inode_item/20210506-042129 git checkout f61feb554b6d2710f17960a9775bf9ba41bb2dc2 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <redacted> All warnings (new ones prefixed by >>):
quoted
fs/btrfs/verity.c:434:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (desc != NULL) {
^~~~~~~~~~~~
fs/btrfs/verity.c:470:9: note: uninitialized use occurs here
return ret;
^~~
fs/btrfs/verity.c:434:2: note: remove the 'if' if its condition is always true
if (desc != NULL) {
^~~~~~~~~~~~~~~~~~
fs/btrfs/verity.c:432:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
vim +434 fs/btrfs/verity.c
417
418 /*
419 * fsverity op that ends enabling verity.
420 * fsverity calls this when it's done with all of the pages in the file
421 * and all of the merkle items have been inserted. We write the
422 * descriptor and update the inode in the btree to reflect its new life
423 * as a verity file.
424 */
425 static int btrfs_end_enable_verity(struct file *filp, const void *desc,
426 size_t desc_size, u64 merkle_tree_size)
427 {
428 struct btrfs_trans_handle *trans;
429 struct inode *inode = file_inode(filp);
430 struct btrfs_root *root = BTRFS_I(inode)->root;
431 struct btrfs_verity_descriptor_item item;
432 int ret;
433
> 434 if (desc != NULL) {
435 /* write out the descriptor item */
436 memset(&item, 0, sizeof(item));
437 btrfs_set_stack_verity_descriptor_size(&item, desc_size);
438 ret = write_key_bytes(BTRFS_I(inode),
439 BTRFS_VERITY_DESC_ITEM_KEY, 0,
440 (const char *)&item, sizeof(item));
441 if (ret)
442 goto out;
443 /* write out the descriptor itself */
444 ret = write_key_bytes(BTRFS_I(inode),
445 BTRFS_VERITY_DESC_ITEM_KEY, 1,
446 desc, desc_size);
447 if (ret)
448 goto out;
449
450 /* update our inode flags to include fs verity */
451 trans = btrfs_start_transaction(root, 1);
452 if (IS_ERR(trans)) {
453 ret = PTR_ERR(trans);
454 goto out;
455 }
456 BTRFS_I(inode)->compat_flags |= BTRFS_INODE_VERITY;
457 btrfs_sync_inode_flags_to_i_flags(inode);
458 ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
459 btrfs_end_transaction(trans);
460 }
461
462 out:
463 if (desc == NULL || ret) {
464 /* If we failed, drop all the verity items */
465 drop_verity_items(BTRFS_I(inode), BTRFS_VERITY_DESC_ITEM_KEY);
466 drop_verity_items(BTRFS_I(inode), BTRFS_VERITY_MERKLE_ITEM_KEY);
467 } else
468 btrfs_set_fs_compat_ro(root->fs_info, VERITY);
469 clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &BTRFS_I(inode)->runtime_flags);
470 return ret;
471 }
472
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Attachments
- .config.gz [application/gzip] 35932 bytes