All of lore.kernel.org
 help / color / mirror / Atom feed
* [sashal-stable:pending-5.4 10/15] fs/btrfs/tree-checker.c:767:46: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct btrfs_item *'
@ 2022-02-18  0:24 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-02-18  0:24 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git pending-5.4
head:   65d5f84ef6b4a30cf78cd72437c1adc92f4af205
commit: 5054a249363156992a4b6a3ab1a0be76feda7bf1 [10/15] btrfs: tree-checker: check item_size for dev_item
config: x86_64-randconfig-a003 (https://download.01.org/0day-ci/archive/20220218/202202180846.wcHCjYMX-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/commit/?id=5054a249363156992a4b6a3ab1a0be76feda7bf1
        git remote add sashal-stable https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
        git fetch --no-tags sashal-stable pending-5.4
        git checkout 5054a249363156992a4b6a3ab1a0be76feda7bf1
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/btrfs/

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/tree-checker.c:767:46: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct btrfs_item *' [-Wint-conversion]
           const u32 item_size = btrfs_item_size(leaf, slot);
                                                       ^~~~
   fs/btrfs/ctree.h:1731:1: note: passing argument to parameter 's' here
   BTRFS_SETGET_FUNCS(item_size, struct btrfs_item, size, 32);
   ^
   fs/btrfs/ctree.h:1352:20: note: expanded from macro 'BTRFS_SETGET_FUNCS'
                                      const type *s)                       \
                                                  ^
   1 warning generated.


vim +767 fs/btrfs/tree-checker.c

   762	
   763	static int check_dev_item(struct extent_buffer *leaf,
   764				  struct btrfs_key *key, int slot)
   765	{
   766		struct btrfs_dev_item *ditem;
 > 767		const u32 item_size = btrfs_item_size(leaf, slot);
   768	
   769		if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) {
   770			dev_item_err(leaf, slot,
   771				     "invalid objectid: has=%llu expect=%llu",
   772				     key->objectid, BTRFS_DEV_ITEMS_OBJECTID);
   773			return -EUCLEAN;
   774		}
   775	
   776		if (unlikely(item_size != sizeof(*ditem))) {
   777			dev_item_err(leaf, slot, "invalid item size: has %u expect %zu",
   778				     item_size, sizeof(*ditem));
   779			return -EUCLEAN;
   780		}
   781	
   782		ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);
   783		if (btrfs_device_id(leaf, ditem) != key->offset) {
   784			dev_item_err(leaf, slot,
   785				     "devid mismatch: key has=%llu item has=%llu",
   786				     key->offset, btrfs_device_id(leaf, ditem));
   787			return -EUCLEAN;
   788		}
   789	
   790		/*
   791		 * For device total_bytes, we don't have reliable way to check it, as
   792		 * it can be 0 for device removal. Device size check can only be done
   793		 * by dev extents check.
   794		 */
   795		if (btrfs_device_bytes_used(leaf, ditem) >
   796		    btrfs_device_total_bytes(leaf, ditem)) {
   797			dev_item_err(leaf, slot,
   798				     "invalid bytes used: have %llu expect [0, %llu]",
   799				     btrfs_device_bytes_used(leaf, ditem),
   800				     btrfs_device_total_bytes(leaf, ditem));
   801			return -EUCLEAN;
   802		}
   803		/*
   804		 * Remaining members like io_align/type/gen/dev_group aren't really
   805		 * utilized.  Skip them to make later usage of them easier.
   806		 */
   807		return 0;
   808	}
   809	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-18  0:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  0:24 [sashal-stable:pending-5.4 10/15] fs/btrfs/tree-checker.c:767:46: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct btrfs_item *' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.