Re: [PATCH v5 2/3] btrfs: initial fsverity support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Boris,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on next-20210624]
[cannot apply to v5.13-rc7]
[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/20210625-064209
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: x86_64-randconfig-a006-20210622 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9ca0171a9ffdef5fdb1511d197a3fd72490362de)
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/24749321fc3abc183fb4ed2c9ac21e556523fc55
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Boris-Burkov/btrfs-support-fsverity/20210625-064209
        git checkout 24749321fc3abc183fb4ed2c9ac21e556523fc55
        # 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 <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/btrfs/verity.c:217:6: warning: variable 'copied' set but not used [-Wunused-but-set-variable]
           u64 copied = 0;
               ^
   fs/btrfs/verity.c:536:21: warning: unused variable 'root' [-Wunused-variable]
           struct btrfs_root *root = inode->root;
                              ^
   fs/btrfs/verity.c:552:24: warning: variable 'trans' is uninitialized when used here [-Wuninitialized]
           btrfs_end_transaction(trans);
                                 ^~~~~
   fs/btrfs/verity.c:537:34: note: initialize the variable 'trans' to silence this warning
           struct btrfs_trans_handle *trans;
                                           ^
                                            = NULL
   3 warnings generated.


vim +/copied +217 fs/btrfs/verity.c

   191	
   192	
   193	/*
   194	 * Insert and write inode items with a given key type and offset.
   195	 *
   196	 * @inode: The inode to insert for.
   197	 * @key_type: The key type to insert.
   198	 * @offset: The item offset to insert at.
   199	 * @src: Source data to write.
   200	 * @len: Length of source data to write.
   201	 *
   202	 * Write len bytes from src into items of up to 1k length.
   203	 * The inserted items will have key <ino, key_type, offset + off> where
   204	 * off is consecutively increasing from 0 up to the last item ending at
   205	 * offset + len.
   206	 *
   207	 * Returns 0 on success and a negative error code on failure.
   208	 */
   209	static int write_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,
   210				   const char *src, u64 len)
   211	{
   212		struct btrfs_trans_handle *trans;
   213		struct btrfs_path *path;
   214		struct btrfs_root *root = inode->root;
   215		struct extent_buffer *leaf;
   216		struct btrfs_key key;
 > 217		u64 copied = 0;
   218		unsigned long copy_bytes;
   219		unsigned long src_offset = 0;
   220		void *data;
   221		int ret;
   222	
   223		path = btrfs_alloc_path();
   224		if (!path)
   225			return -ENOMEM;
   226	
   227		while (len > 0) {
   228			/*
   229			 * 1 for the new item being inserted
   230			 */
   231			trans = btrfs_start_transaction(root, 1);
   232			if (IS_ERR(trans)) {
   233				ret = PTR_ERR(trans);
   234				break;
   235			}
   236	
   237			key.objectid = btrfs_ino(inode);
   238			key.type = key_type;
   239			key.offset = offset;
   240	
   241			/*
   242			 * Insert 2K at a time mostly to be friendly for smaller
   243			 * leaf size filesystems
   244			 */
   245			copy_bytes = min_t(u64, len, 2048);
   246	
   247			ret = btrfs_insert_empty_item(trans, root, path, &key, copy_bytes);
   248			if (ret) {
   249				btrfs_end_transaction(trans);
   250				break;
   251			}
   252	
   253			leaf = path->nodes[0];
   254	
   255			data = btrfs_item_ptr(leaf, path->slots[0], void);
   256			write_extent_buffer(leaf, src + src_offset,
   257					    (unsigned long)data, copy_bytes);
   258			offset += copy_bytes;
   259			src_offset += copy_bytes;
   260			len -= copy_bytes;
   261			copied += copy_bytes;
   262	
   263			btrfs_release_path(path);
   264			btrfs_end_transaction(trans);
   265		}
   266	
   267		btrfs_free_path(path);
   268		return ret;
   269	}
   270	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [linux Cryptography]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]

  Powered by Linux