Skip to contentSkip to conversation

io_uring: initialize vairable "sqe" to silence build warning

PATCH In review Mallikarjun Thammanavar 3 participants 4 messages Oct 22, 2025

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

PATCH 1/1 io_uring: initialize vairable "sqe" to silence build warning

clang-17 compiler throws build error when [-Werror,-Wuninitialized] are enabled
error: variable 'sqe' is uninitialized when used here [-Werror,-Wuninitialized]

Initialize struct io_uring_sqe *sqe = NULL; to have clean build

---
 io_uring/fdinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/fdinfo.c +1 -1
index d5aa64203de5..e5792b794f8b 100644
@@ -89,7 +89,7 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
 	seq_printf(m, "CachedCqTail:\t%u\n", data_race(ctx->cached_cq_tail));
 	seq_printf(m, "SQEs:\t%u\n", sq_tail - sq_head);
 	while (sq_head < sq_tail) {
-		struct io_uring_sqe *sqe;
+		struct io_uring_sqe *sqe = NULL;
 		unsigned int sq_idx;
 		bool sqe128 = false;
 		u8 opcode;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 17 lines · Mallikarjun Thammanavar

clang-17 compiler throws build error when [-Werror,-Wuninitialized] are enabled
error: variable 'sqe' is uninitialized when used here [-Werror,-Wuninitialized]

Initialize struct io_uring_sqe *sqe = NULL; to have clean build

---
 io_uring/fdinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/fdinfo.c +0 -0
index d5aa64203de5..e5792b794f8b 100644

io_uring/fdinfo.c static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m) · line 92

Quoted 5 lines
io_uring/fdinfo.c +1 -1
@@ -89,7 +89,7 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
 	seq_printf(m, "CachedCqTail:\t%u\n", data_race(ctx->cached_cq_tail));
 	seq_printf(m, "SQEs:\t%u\n", sq_tail - sq_head);
 	while (sq_head < sq_tail) {
-		struct io_uring_sqe *sqe;
+		struct io_uring_sqe *sqe = NULL;

If you do that, then other tools will report a NULL dereference, right?

Please fix the tools, don't paper over stuff like this.

thanks,

greg k-h

maintainer
#2 lore raw
In reply to Mallikarjun Thammanavar
Quoted 2 lines · Mallikarjun Thammanavar

clang-17 compiler throws build error when [-Werror,-Wuninitialized] are enabled
error: variable 'sqe' is uninitialized when used here [-Werror,-Wuninitialized]

Already fixed, and as Greg mentioned, this may silence the warning but now it'll cause a NULL pointer deref instead...

Signature · 1 line
Jens Axboe
#3 lore raw

Thanks, Greg and Jens, for pointing this out.

I understand that this issue has already been fixed, and I’ll make sure to pay closer attention in future submissions.

regards,
Mallikarjun