tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
pending-5.10
head: c7460074320c38fd9956dc1923fd4ccfdb7437b0
commit: 1f509454ef33a91f39e90978ef9be20e03003194 [16/26] btrfs: tree-checker: check
item_size for dev_item
config: alpha-randconfig-r004-20220217
(
https://download.01.org/0day-ci/archive/20220218/202202180541.GzlLhFrd-lk...)
compiler: alpha-linux-gcc (GCC) 11.2.0
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/c...
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.10
git checkout 1f509454ef33a91f39e90978ef9be20e03003194
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir
ARCH=alpha SHELL=/bin/bash fs/btrfs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
fs/btrfs/tree-checker.c: In function 'check_dev_item':
> fs/btrfs/tree-checker.c:950:53: warning: passing argument 2 of
'btrfs_item_size' makes pointer from integer without a cast [-Wint-conversion]
950 | const u32 item_size = btrfs_item_size(leaf, slot);
| ^~~~
| |
| int
In file included from fs/btrfs/tree-checker.c:21:
fs/btrfs/ctree.h:1474:48: note: expected 'const struct btrfs_item *' but
argument is of type 'int'
1474 | const type *s) \
| ~~~~~~~~~~~~^
fs/btrfs/ctree.h:1833:1: note: in expansion of macro 'BTRFS_SETGET_FUNCS'
1833 | BTRFS_SETGET_FUNCS(item_size, struct btrfs_item, size, 32);
| ^~~~~~~~~~~~~~~~~~
vim +/btrfs_item_size +950 fs/btrfs/tree-checker.c
945
946 static int check_dev_item(struct extent_buffer *leaf,
947 struct btrfs_key *key, int slot)
948 {
949 struct btrfs_dev_item *ditem;
950 const u32 item_size = btrfs_item_size(leaf, slot);
951
952 if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) {
953 dev_item_err(leaf, slot,
954 "invalid objectid: has=%llu expect=%llu",
955 key->objectid, BTRFS_DEV_ITEMS_OBJECTID);
956 return -EUCLEAN;
957 }
958
959 if (unlikely(item_size != sizeof(*ditem))) {
960 dev_item_err(leaf, slot, "invalid item size: has %u expect %zu",
961 item_size, sizeof(*ditem));
962 return -EUCLEAN;
963 }
964
965 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);
966 if (btrfs_device_id(leaf, ditem) != key->offset) {
967 dev_item_err(leaf, slot,
968 "devid mismatch: key has=%llu item has=%llu",
969 key->offset, btrfs_device_id(leaf, ditem));
970 return -EUCLEAN;
971 }
972
973 /*
974 * For device total_bytes, we don't have reliable way to check it, as
975 * it can be 0 for device removal. Device size check can only be done
976 * by dev extents check.
977 */
978 if (btrfs_device_bytes_used(leaf, ditem) >
979 btrfs_device_total_bytes(leaf, ditem)) {
980 dev_item_err(leaf, slot,
981 "invalid bytes used: have %llu expect [0, %llu]",
982 btrfs_device_bytes_used(leaf, ditem),
983 btrfs_device_total_bytes(leaf, ditem));
984 return -EUCLEAN;
985 }
986 /*
987 * Remaining members like io_align/type/gen/dev_group aren't really
988 * utilized. Skip them to make later usage of them easier.
989 */
990 return 0;
991 }
992
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org