Skip to contentSkip to conversation

io_uring: fix uninitialized return

PATCH In review [email protected] 2 participants 3 messages Feb 7, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix uninitialized return

From: Tom Rix <[email protected]>

The clang build fails with this error
io_uring.c:9396:9: error: variable 'ret' is uninitialized when used here

        return ret;
               ^~~~

Return 0 directly.

Fixes b77e315a9644 ("io_uring: avoid ring quiesce while registering/unregistering eventfd")
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index aadabb31d6da7..74afb96af214c 100644
@@ -9393,7 +9393,7 @@ static int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg,
 	ev_fd->eventfd_async = eventfd_async;
 
 	rcu_assign_pointer(ctx->io_ev_fd, ev_fd);
-	return ret;
+	return 0;
 }
 
 static void io_eventfd_put(struct rcu_head *rcu)
Signature · 1 line
2.26.3
#1 lore raw
Quoted 11 lines · On Mon, Feb 7, 2022 at 10:51 AM <[email protected]> wrote:

From: Tom Rix <[email protected]>

The clang build fails with this error
io_uring.c:9396:9: error: variable 'ret' is uninitialized when used here

        return ret;
               ^~~~

Return 0 directly.

Fixes b77e315a9644 ("io_uring: avoid ring quiesce while registering/unregistering eventfd")

Thanks for the patch:
See also:
https://lore.kernel.org/llvm/[email protected]/

Quoted 20 lines
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -2
index aadabb31d6da7..74afb96af214c 100644
@@ -9393,7 +9393,7 @@ static int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg,
        ev_fd->eventfd_async = eventfd_async;
 
        rcu_assign_pointer(ctx->io_ev_fd, ev_fd);
-       return ret;
+       return 0;
 }
 
 static void io_eventfd_put(struct rcu_head *rcu)
--

2.26.3

Signature · 2 lines
Thanks,
~Nick Desaulniers
author
#2 lore raw
Quoted 9 lines · Nick Desaulniers
Quoted 8 lines · On Mon, Feb 7, 2022 at 10:51 AM <[email protected]> wrote:

From: Tom Rix <[email protected]>

The clang build fails with this error
io_uring.c:9396:9: error: variable 'ret' is uninitialized when used here

         return ret;
                ^~~~

Return 0 directly.

Quoted 5 lines
Quoted 2 lines
Fixes b77e315a9644 ("io_uring: avoid ring quiesce while registering/unregistering eventfd")

Thanks for the patch:
See also:
https://lore.kernel.org/llvm/[email protected]/

No worries as long as it gets fixed.

Tom

Quoted 22 lines
Quoted 21 lines
---
  fs/io_uring.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -2
index aadabb31d6da7..74afb96af214c 100644
@@ -9393,7 +9393,7 @@ static int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg,
         ev_fd->eventfd_async = eventfd_async;
 
         rcu_assign_pointer(ctx->io_ev_fd, ev_fd);
-       return ret;
+       return 0;
  }
 
  static void io_eventfd_put(struct rcu_head *rcu)
--

2.26.3