[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202209071546.NtCUey2f-lkp@intel.com>
Date: Wed, 7 Sep 2022 15:39:08 +0800
From: kernel test robot <lkp@...el.com>
To: Bo Liu <liubo03@...pur.com>, viro@...iv.linux.org.uk
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Bo Liu <liubo03@...pur.com>
Subject: Re: [PATCH] eventfd: check ida_simple_get() return value
Hi Bo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc4 next-20220906]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bo-Liu/eventfd-check-ida_simple_get-return-value/20220907-103955
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0066f1b0e27556381402db3ff31f85d2a2265858
config: hexagon-randconfig-r041-20220906
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c55b41d5199d2394dd6cdb8f52180d8b81d809d4)
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/intel-lab-lkp/linux/commit/04c5de6820d9c8b7e64a74150d30406cf7f43511
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Bo-Liu/eventfd-check-ida_simple_get-return-value/20220907-103955
git checkout 04c5de6820d9c8b7e64a74150d30406cf7f43511
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> fs/eventfd.c:427:6: warning: variable 'fd' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ctx->id < 0)
^~~~~~~~~~~
fs/eventfd.c:448:9: note: uninitialized use occurs here
return fd;
^~
fs/eventfd.c:427:2: note: remove the 'if' if its condition is always false
if (ctx->id < 0)
^~~~~~~~~~~~~~~~
fs/eventfd.c:409:8: note: initialize the variable 'fd' to silence this warning
int fd;
^
= 0
1 warning generated.
vim +427 fs/eventfd.c
404
405 static int do_eventfd(unsigned int count, int flags)
406 {
407 struct eventfd_ctx *ctx;
408 struct file *file;
409 int fd;
410
411 /* Check the EFD_* constants for consistency. */
412 BUILD_BUG_ON(EFD_CLOEXEC != O_CLOEXEC);
413 BUILD_BUG_ON(EFD_NONBLOCK != O_NONBLOCK);
414
415 if (flags & ~EFD_FLAGS_SET)
416 return -EINVAL;
417
418 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
419 if (!ctx)
420 return -ENOMEM;
421
422 kref_init(&ctx->kref);
423 init_waitqueue_head(&ctx->wqh);
424 ctx->count = count;
425 ctx->flags = flags;
426 ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
> 427 if (ctx->id < 0)
428 goto err;
429
430 flags &= EFD_SHARED_FCNTL_FLAGS;
431 flags |= O_RDWR;
432 fd = get_unused_fd_flags(flags);
433 if (fd < 0)
434 goto err;
435
436 file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, flags);
437 if (IS_ERR(file)) {
438 put_unused_fd(fd);
439 fd = PTR_ERR(file);
440 goto err;
441 }
442
443 file->f_mode |= FMODE_NOWAIT;
444 fd_install(fd, file);
445 return fd;
446 err:
447 eventfd_free_ctx(ctx);
448 return fd;
449 }
450
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (117817 bytes)
Powered by blists - more mailing lists