All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [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 *'
Date: Fri, 18 Feb 2022 08:24:08 +0800	[thread overview]
Message-ID: <202202180846.wcHCjYMX-lkp@intel.com> (raw)

[-- 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

                 reply	other threads:[~2022-02-18  0:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202202180846.wcHCjYMX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.