Re: [PATCH v3 2/5] btrfs: initial fsverity support

kernel test robot
2021-04-08T22:57:19Z

[-- Attachment #1: Type: text/plain, Size: 4534 bytes --]

Hi Boris,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on next-20210408]
[cannot apply to v5.12-rc6]
[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-support-fsverity/20210409-023606
base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: arm64-randconfig-r021-20210408 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 56ea2e2fdd691136d5e6631fa0e447173694b82c)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/dd118218fea47389631a62ec533207ba39e69b41
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Boris-Burkov/btrfs-support-fsverity/20210409-023606
git checkout dd118218fea47389631a62ec533207ba39e69b41
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> fs/btrfs/verity.c:432:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (desc != NULL) {
^~~~~~~~~~~~
fs/btrfs/verity.c:468:9: note: uninitialized use occurs here
return ret;
^~~
fs/btrfs/verity.c:432:2: note: remove the 'if' if its condition is always true
if (desc != NULL) {
^~~~~~~~~~~~~~~~~~
fs/btrfs/verity.c:430:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.

vim +432 fs/btrfs/verity.c

415
416 /*
417 * fsverity op that ends enabling verity.
418 * fsverity calls this when it's done with all of the pages in the file
419 * and all of the merkle items have been inserted. We write the
420 * descriptor and update the inode in the btree to reflect its new life
421 * as a verity file.
422 */
423 static int btrfs_end_enable_verity(struct file *filp, const void *desc,
424 size_t desc_size, u64 merkle_tree_size)
425 {
426 struct btrfs_trans_handle *trans;
427 struct inode *inode = file_inode(filp);
428 struct btrfs_root *root = BTRFS_I(inode)->root;
429 struct btrfs_verity_descriptor_item item;
430 int ret;
431
> 432 if (desc != NULL) {
433 /* write out the descriptor item */
434 memset(&item, 0, sizeof(item));
435 btrfs_set_stack_verity_descriptor_size(&item, desc_size);
436 ret = write_key_bytes(BTRFS_I(inode),
437 BTRFS_VERITY_DESC_ITEM_KEY, 0,
438 (const char *)&item, sizeof(item));
439 if (ret)
440 goto out;
441 /* write out the descriptor itself */
442 ret = write_key_bytes(BTRFS_I(inode),
443 BTRFS_VERITY_DESC_ITEM_KEY, 1,
444 desc, desc_size);
445 if (ret)
446 goto out;
447
448 /* update our inode flags to include fs verity */
449 trans = btrfs_start_transaction(root, 1);
450 if (IS_ERR(trans)) {
451 ret = PTR_ERR(trans);
452 goto out;
453 }
454 BTRFS_I(inode)->compat_flags |= BTRFS_INODE_VERITY;
455 btrfs_sync_inode_flags_to_i_flags(inode);
456 ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
457 btrfs_end_transaction(trans);
458 }
459
460 out:
461 if (desc == NULL || ret) {
462 /* If we failed, drop all the verity items */
463 drop_verity_items(BTRFS_I(inode), BTRFS_VERITY_DESC_ITEM_KEY);
464 drop_verity_items(BTRFS_I(inode), BTRFS_VERITY_MERKLE_ITEM_KEY);
465 } else
466 btrfs_set_fs_compat_ro(root->fs_info, VERITY);
467 clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &BTRFS_I(inode)->runtime_flags);
468 return ret;
469 }
470

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45592 bytes --]