* [block:for-5.12/io_uring 29/34] fs/io_uring.c:4494:6: warning: variable 'file' is used uninitialized whenever 'if' condition is true
@ 2021-01-20 12:41 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-01-20 12:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3622 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.12/io_uring
head: ddebaa7f62a202b40378a5a71d1a51737277d773
commit: 21e779401a16d6f6ca4b5570cdd9b19a29d68bab [29/34] io_uring: get rid of intermediate IORING_OP_CLOSE stage
config: x86_64-randconfig-a003-20210120 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 22b68440e1647e16b5ee24b924986207173c02d1)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=21e779401a16d6f6ca4b5570cdd9b19a29d68bab
git remote add block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags block for-5.12/io_uring
git checkout 21e779401a16d6f6ca4b5570cdd9b19a29d68bab
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
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/io_uring.c:4494:6: warning: variable 'file' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (close->fd >= fdt->max_fds) {
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/io_uring.c:4523:7: note: uninitialized use occurs here
fput(file);
^~~~
fs/io_uring.c:4494:2: note: remove the 'if' if its condition is always false
if (close->fd >= fdt->max_fds) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/io_uring.c:4488:19: note: initialize the variable 'file' to silence this warning
struct file *file;
^
= NULL
1 warning generated.
vim +4494 fs/io_uring.c
4481
4482 static int io_close(struct io_kiocb *req, bool force_nonblock,
4483 struct io_comp_state *cs)
4484 {
4485 struct files_struct *files = current->files;
4486 struct io_close *close = &req->close;
4487 struct fdtable *fdt;
4488 struct file *file;
4489 int ret;
4490
4491 ret = -EBADF;
4492 spin_lock(&files->file_lock);
4493 fdt = files_fdtable(files);
> 4494 if (close->fd >= fdt->max_fds) {
4495 spin_unlock(&files->file_lock);
4496 goto err;
4497 }
4498 file = fdt->fd[close->fd];
4499 if (!file) {
4500 spin_unlock(&files->file_lock);
4501 goto err;
4502 }
4503
4504 /* if the file has a flush method, be safe and punt to async */
4505 if (file->f_op->flush && force_nonblock) {
4506 spin_unlock(&files->file_lock);
4507 return -EAGAIN;
4508 }
4509
4510 ret = __close_fd_get_file(close->fd, &file);
4511 spin_unlock(&files->file_lock);
4512 if (ret < 0) {
4513 if (ret == -ENOENT)
4514 ret = -EBADF;
4515 goto err;
4516 }
4517
4518 /* No ->flush() or already async, safely close from here */
4519 ret = filp_close(file, current->files);
4520 err:
4521 if (ret < 0)
4522 req_set_fail_links(req);
4523 fput(file);
4524 __io_req_complete(req, ret, 0, cs);
4525 return 0;
4526 }
4527
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 46067 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-20 12:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 12:41 [block:for-5.12/io_uring 29/34] fs/io_uring.c:4494:6: warning: variable 'file' is used uninitialized whenever 'if' condition is true kernel test robot
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.