IO-Uring Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH][next] io_uring: fix return of an uninitialized variable ret
@ 2020-02-11 16:02 Colin King
  2020-02-11 16:07 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-02-11 16:02 UTC (permalink / raw)
  To: Jens Axboe, Alexander Viro, io-uring, linux-fsdevel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently variable ret is not initialized and this value is being
returned at the end of the function io_poll_double_wake.  Since
ret is not being used anywhere else remove it and just return 0.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: f6e84af0767f ("io_uring: allow POLL_ADD with double poll_wait() users")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 72bc378edebc..5c6a899b51d8 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3707,7 +3707,6 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
 	struct io_poll_iocb *poll = (void *) req->io;
 	__poll_t mask = key_to_poll(key);
 	bool done = true;
-	int ret;
 
 	/* for instances that support it check for an event match first: */
 	if (mask && !(mask & poll->events))
@@ -3725,7 +3724,7 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
 	if (!done)
 		__io_poll_wake(req, poll, mask);
 	refcount_dec(&req->refs);
-	return ret;
+	return 0;
 }
 
 struct io_poll_table {
-- 
2.25.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] io_uring: fix return of an uninitialized variable ret
  2020-02-11 16:02 [PATCH][next] io_uring: fix return of an uninitialized variable ret Colin King
@ 2020-02-11 16:07 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-02-11 16:07 UTC (permalink / raw)
  To: Colin King, Alexander Viro, io-uring, linux-fsdevel
  Cc: kernel-janitors, linux-kernel

On 2/11/20 9:02 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently variable ret is not initialized and this value is being
> returned at the end of the function io_poll_double_wake.  Since
> ret is not being used anywhere else remove it and just return 0.

It's supposed to return 1, a previous edition had 'ret' dependent
on the wake call, but we didn't need that anymore.

I folded in a fix earlier this morning, and my for-next branch should
now be fine.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-11 16:02 [PATCH][next] io_uring: fix return of an uninitialized variable ret Colin King
2020-02-11 16:07 ` Jens Axboe

IO-Uring Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/io-uring/0 io-uring/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 io-uring io-uring/ https://lore.kernel.org/io-uring \
		io-uring@vger.kernel.org
	public-inbox-index io-uring

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.io-uring


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git