Re: [ceph-client:testing 13/14] fs/ceph/snap.c:438:14: warning: variable '_realm' is uninitialized when used here

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

 



On Thu, 2022-02-17 at 03:33 +0800, kernel test robot wrote:
> tree:   https://github.com/ceph/ceph-client.git testing
> head:   91e59cfc6ca1a2bf594f60474996c71047edd1e5
> commit: 7c7e63bc9910b15ffd1f791838ff0a919058f97c [13/14] ceph: eliminate the recursion when rebuilding the snap context
> config: hexagon-randconfig-r005-20220216 (https://download.01.org/0day-ci/archive/20220217/202202170318.82LIXBXX-lkp@xxxxxxxxx/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0e628a783b935c70c80815db6c061ec84f884af5)
> 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://github.com/ceph/ceph-client/commit/7c7e63bc9910b15ffd1f791838ff0a919058f97c
>         git remote add ceph-client https://github.com/ceph/ceph-client.git
>         git fetch --no-tags ceph-client testing
>         git checkout 7c7e63bc9910b15ffd1f791838ff0a919058f97c
>         # 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=hexagon SHELL=/bin/bash fs/ceph/
> 
> 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/ceph/snap.c:438:14: warning: variable '_realm' is uninitialized when used here [-Wuninitialized]
>                            list_del(&_realm->rebuild_item);
>                                      ^~~~~~
>    fs/ceph/snap.c:430:33: note: initialize the variable '_realm' to silence this warning
>                    struct ceph_snap_realm *_realm, *child;
>                                                  ^
>                                                   = NULL
>    1 warning generated.
> 
> 
> vim +/_realm +438 fs/ceph/snap.c
> 
>    417	
>    418	/*
>    419	 * rebuild snap context for the given realm and all of its children.
>    420	 */
>    421	static void rebuild_snap_realms(struct ceph_snap_realm *realm,
>    422					struct list_head *dirty_realms)
>    423	{
>    424		LIST_HEAD(realm_queue);
>    425		int last = 0;
>    426	
>    427		list_add_tail(&realm->rebuild_item, &realm_queue);
>    428	
>    429		while (!list_empty(&realm_queue)) {
>    430			struct ceph_snap_realm *_realm, *child;
>    431	
>    432			/*
>    433			 * If the last building failed dues to memory
>    434			 * issue, just empty the realm_queue and return
>    435			 * to avoid infinite loop.
>    436			 */
>    437			if (last < 0) {
>  > 438				list_del(&_realm->rebuild_item);
>    439				continue;
>    440			}
>    441	
>    442			_realm = list_first_entry(&realm_queue,
>    443						  struct ceph_snap_realm,
>    444						  rebuild_item);

Xiubo, I think we just need to move this assignment of _realm above the
previous if block. I've made that change in-tree. Please take a look and
make sure it looks OK to you.


>    445			last = build_snap_context(_realm, &realm_queue, dirty_realms);
>    446			dout("rebuild_snap_realms %llx %p, %s\n", _realm->ino, _realm,
>    447			     last > 0 ? "is deferred" : !last ? "succeeded" : "failed");
>    448	
>    449			list_for_each_entry(child, &_realm->children, child_item)
>    450				list_add_tail(&child->rebuild_item, &realm_queue);
>    451	
>    452			/* last == 1 means need to build parent first */
>    453			if (last <= 0)
>    454				list_del(&_realm->rebuild_item);
>    455		}
>    456	}
>    457	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Thanks, KTR!
-- 
Jeff Layton <jlayton@xxxxxxxxxx>



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux