linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, wenyang.linux@foxmail.com,
	Alexander Viro <viro@zeniv.linux.org.uk>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Wen Yang <wenyang.linux@foxmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] eventfd: use a generic helper instead of an open coded wait_event
Date: Sat, 24 Dec 2022 10:16:56 +0300	[thread overview]
Message-ID: <202212240819.6KA20geM-lkp@intel.com> (raw)
In-Reply-To: <tencent_B38979DE0FF3B9B3EA887A37487B123BBD05@qq.com>

Hi,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/wenyang-linux-foxmail-com/eventfd-use-a-generic-helper-instead-of-an-open-coded-wait_event/20221222-234947
patch link:    https://lore.kernel.org/r/tencent_B38979DE0FF3B9B3EA887A37487B123BBD05%40qq.com
patch subject: [PATCH] eventfd: use a generic helper instead of an open coded wait_event
config: i386-randconfig-m021
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>

smatch warnings:
fs/eventfd.c:254 eventfd_read() warn: inconsistent returns '&ctx->wqh.lock'.

vim +254 fs/eventfd.c

12aceb89b0bce1 Jens Axboe     2020-05-01  226  static ssize_t eventfd_read(struct kiocb *iocb, struct iov_iter *to)
e1ad7468c77ddb Davide Libenzi 2007-05-10  227  {
12aceb89b0bce1 Jens Axboe     2020-05-01  228  	struct file *file = iocb->ki_filp;
b6364572d641c8 Eric Biggers   2018-01-06  229  	struct eventfd_ctx *ctx = file->private_data;
b6364572d641c8 Eric Biggers   2018-01-06  230  	__u64 ucnt = 0;
e1ad7468c77ddb Davide Libenzi 2007-05-10  231  
12aceb89b0bce1 Jens Axboe     2020-05-01  232  	if (iov_iter_count(to) < sizeof(ucnt))
b6364572d641c8 Eric Biggers   2018-01-06  233  		return -EINVAL;
d48eb233159522 Davide Libenzi 2007-05-18  234  	spin_lock_irq(&ctx->wqh.lock);
12aceb89b0bce1 Jens Axboe     2020-05-01  235  	if (!ctx->count) {
12aceb89b0bce1 Jens Axboe     2020-05-01  236  		if ((file->f_flags & O_NONBLOCK) ||
12aceb89b0bce1 Jens Axboe     2020-05-01  237  		    (iocb->ki_flags & IOCB_NOWAIT)) {
12aceb89b0bce1 Jens Axboe     2020-05-01  238  			spin_unlock_irq(&ctx->wqh.lock);
12aceb89b0bce1 Jens Axboe     2020-05-01  239  			return -EAGAIN;
12aceb89b0bce1 Jens Axboe     2020-05-01  240  		}
c908f8e6a3a1eb Wen Yang       2022-12-22  241  
c908f8e6a3a1eb Wen Yang       2022-12-22  242  		if (wait_event_interruptible_locked_irq(ctx->wqh, ctx->count))
12aceb89b0bce1 Jens Axboe     2020-05-01  243  			return -ERESTARTSYS;

spin_unlock_irq(&ctx->wqh.lock);

e1ad7468c77ddb Davide Libenzi 2007-05-10  244  	}
b6364572d641c8 Eric Biggers   2018-01-06  245  	eventfd_ctx_do_read(ctx, &ucnt);
9f0deaa12d832f Dylan Yudaken  2022-08-16  246  	current->in_eventfd = 1;
e1ad7468c77ddb Davide Libenzi 2007-05-10  247  	if (waitqueue_active(&ctx->wqh))
a9a08845e9acbd Linus Torvalds 2018-02-11  248  		wake_up_locked_poll(&ctx->wqh, EPOLLOUT);
9f0deaa12d832f Dylan Yudaken  2022-08-16  249  	current->in_eventfd = 0;
d48eb233159522 Davide Libenzi 2007-05-18  250  	spin_unlock_irq(&ctx->wqh.lock);
12aceb89b0bce1 Jens Axboe     2020-05-01  251  	if (unlikely(copy_to_iter(&ucnt, sizeof(ucnt), to) != sizeof(ucnt)))
b6364572d641c8 Eric Biggers   2018-01-06  252  		return -EFAULT;
cb289d6244a37c Davide Libenzi 2010-01-13  253  
12aceb89b0bce1 Jens Axboe     2020-05-01 @254  	return sizeof(ucnt);
cb289d6244a37c Davide Libenzi 2010-01-13  255  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


  reply	other threads:[~2022-12-24  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 15:05 [PATCH] eventfd: use a generic helper instead of an open coded wait_event wenyang.linux
2022-12-24  7:16 ` Dan Carpenter [this message]
2022-12-29 10:04 ` kernel test robot

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=202212240819.6KA20geM-lkp@intel.com \
    --to=error27@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wenyang.linux@foxmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).