Skip to contentSkip to conversation

io_uring: initialize count variable to 0

PATCH Applied Tom Rix 3 participants 3 messages Jan 24, 2023 io_uring

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 io_uring: initialize count variable to 0

The clang build fails with
io_uring/io_uring.c:1240:3: error: variable 'count' is uninitialized
when used here [-Werror,-Wuninitialized]
count += handle_tw_list(node, &ctx, &uring_locked, &fake); ^~~~~

The commit listed in the fixes: removed the initialization of count.

Fixes b5b57128d0cd ("io_uring: refactor tctx_task_work")
---
 io_uring/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/io_uring.c +1 -1
index 734d074cdd94..4cb409ae9840 100644
@@ -1227,7 +1227,7 @@ void tctx_task_work(struct callback_head *cb)
 	struct llist_node fake = {};
 	struct llist_node *node;
 	unsigned int loops = 0;
-	unsigned int count;
+	unsigned int count = 0;
 
 	if (unlikely(current->flags & PF_EXITING)) {
 		io_fallback_tw(tctx);
Signature · 1 line
2.26.3
#1 lore raw
Quoted 7 lines · Tom Rix

The clang build fails with
io_uring/io_uring.c:1240:3: error: variable 'count' is uninitialized
when used here [-Werror,-Wuninitialized]

   count += handle_tw_list(node, &ctx, &uring_locked, &fake);
   ^~~~~

The commit listed in the fixes: removed the initialization of count.

My bad. The patch looks good, thanks

Quoted 19 lines
Fixes b5b57128d0cd ("io_uring: refactor tctx_task_work")
---
  io_uring/io_uring.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/io_uring.c +1 -1
index 734d074cdd94..4cb409ae9840 100644
@@ -1227,7 +1227,7 @@ void tctx_task_work(struct callback_head *cb)
  	struct llist_node fake = {};
  	struct llist_node *node;
  	unsigned int loops = 0;
-	unsigned int count;
+	unsigned int count = 0;
 
  	if (unlikely(current->flags & PF_EXITING)) {
  		io_fallback_tw(tctx);
Signature · 1 line
Pavel Begunkov
maintainer Applied
#2 lore raw
In reply to Tom Rix
Quoted 9 lines · Tom Rix

The clang build fails with
io_uring/io_uring.c:1240:3: error: variable 'count' is uninitialized
when used here [-Werror,-Wuninitialized]
count += handle_tw_list(node, &ctx, &uring_locked, &fake); ^~~~~

The commit listed in the fixes: removed the initialization of count.

[...]

Applied, thanks!

[1/1] io_uring: initialize count variable to 0

      commit: 7a9e93db01f44a8d084c93648981cbc1535a734d

Best regards,

Signature · 1 line
Jens Axboe