Re: [PATCH] eventfd: convert global percpu eventfd_wake_count to ctx percpu eventfd_wake_count

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

 



Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.13-rc4 next-20210604]
[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/qiang-zhang-windriver-com/eventfd-convert-global-percpu-eventfd_wake_count-to-ctx-percpu-eventfd_wake_count/20210604-154249
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f88cd3fb9df228e5ce4e13ec3dbad671ddb2146e
config: arm64-randconfig-r013-20210604 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5c0d1b2f902aa6a9cf47cc7e42c5b83bb2217cf9)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/3cff73140b2b518eec3e30712d9c66bbde8ad375
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review qiang-zhang-windriver-com/eventfd-convert-global-percpu-eventfd_wake_count-to-ctx-percpu-eventfd_wake_count/20210604-154249
        git checkout 3cff73140b2b518eec3e30712d9c66bbde8ad375
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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/eventfd.c:434:6: warning: variable 'fd' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!ctx->eventfd_wake_count)
               ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/eventfd.c:461:9: note: uninitialized use occurs here
           return fd;
                  ^~
   fs/eventfd.c:434:2: note: remove the 'if' if its condition is always false
           if (!ctx->eventfd_wake_count)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/eventfd.c:420:8: note: initialize the variable 'fd' to silence this warning
           int fd;
                 ^
                  = 0
   1 warning generated.


vim +434 fs/eventfd.c

   415	
   416	static int do_eventfd(unsigned int count, int flags)
   417	{
   418		struct eventfd_ctx *ctx;
   419		struct file *file;
   420		int fd;
   421	
   422		/* Check the EFD_* constants for consistency.  */
   423		BUILD_BUG_ON(EFD_CLOEXEC != O_CLOEXEC);
   424		BUILD_BUG_ON(EFD_NONBLOCK != O_NONBLOCK);
   425	
   426		if (flags & ~EFD_FLAGS_SET)
   427			return -EINVAL;
   428	
   429		ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
   430		if (!ctx)
   431			return -ENOMEM;
   432	
   433		ctx->eventfd_wake_count = alloc_percpu(int);
 > 434		if (!ctx->eventfd_wake_count)
   435			goto err;
   436	
   437		kref_init(&ctx->kref);
   438		init_waitqueue_head(&ctx->wqh);
   439		ctx->count = count;
   440		ctx->flags = flags;
   441		ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
   442	
   443		flags &= EFD_SHARED_FCNTL_FLAGS;
   444		flags |= O_RDWR;
   445		fd = get_unused_fd_flags(flags);
   446		if (fd < 0)
   447			goto err;
   448	
   449		file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, flags);
   450		if (IS_ERR(file)) {
   451			put_unused_fd(fd);
   452			fd = PTR_ERR(file);
   453			goto err;
   454		}
   455	
   456		file->f_mode |= FMODE_NOWAIT;
   457		fd_install(fd, file);
   458		return fd;
   459	err:
   460		eventfd_free_ctx(ctx);
   461		return fd;
   462	}
   463	

---
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 Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux