Hi Boris,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v5.11-rc6]
[also build test WARNING on next-20210125]
[cannot apply to kdave/for-next]
[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/20210205-072745
base:    1048ba83fb1c00cd24172e23e8263972f6b5d9ac
config: x86_64-randconfig-a002-20210204 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
c9439ca36342fb6013187d0a69aef92736951476)
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/4fb68eb17c9ed350a759646451cba99a19ea7579
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Boris-Burkov/btrfs-support-fsverity/20210205-072745
        git checkout 4fb68eb17c9ed350a759646451cba99a19ea7579
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

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


vim +370 fs/btrfs/verity.c

   355  
   356  /*
   357   * fsverity calls this when it's done with all of the pages in the file
   358   * and all of the merkle items have been inserted.  We write the
   359   * descriptor and update the inode in the btree to reflect it's new life
   360   * as a verity file
   361   */
   362  static int btrfs_end_enable_verity(struct file *filp, const void *desc,
   363                                    size_t desc_size, u64 
merkle_tree_size)
   364  {
   365          struct btrfs_trans_handle *trans;
   366          struct inode *inode = file_inode(filp);
   367          struct btrfs_root *root = BTRFS_I(inode)->root;
   368          int ret;
   369  
 > 370          if (desc != NULL) {
   371                  /* write out the descriptor */
   372                  ret = write_key_bytes(BTRFS_I(inode),
   373                                        BTRFS_VERITY_DESC_ITEM_KEY, 0,
   374                                        desc, desc_size);
   375                  if (ret)
   376                          goto out;
   377  
   378                  /* update our inode flags to include fs verity */
   379                  trans = btrfs_start_transaction(root, 1);
   380                  if (IS_ERR(trans)) {
   381                          ret = PTR_ERR(trans);
   382                          goto out;
   383                  }
   384                  BTRFS_I(inode)->compat_flags |= BTRFS_INODE_VERITY;
   385                  btrfs_sync_inode_flags_to_i_flags(inode);
   386                  ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
   387                  btrfs_end_transaction(trans);
   388          }
   389  
   390  out:
   391          if (desc == NULL || ret) {
   392                  /* If we failed, drop all the verity items */
   393                  drop_verity_items(BTRFS_I(inode), 
BTRFS_VERITY_DESC_ITEM_KEY);
   394                  drop_verity_items(BTRFS_I(inode), 
BTRFS_VERITY_MERKLE_ITEM_KEY);
   395          }
   396          clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, 
&BTRFS_I(inode)->runtime_flags);
   397          return ret;
   398  }
   399  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to