From d50f94d761a5d9a34e03a86e512e19d88cbeaf06 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 30 Oct 2024 09:51:58 -0600 Subject: io_uring/rsrc: get rid of the empty node and dummy_ubuf The empty node was used as a placeholder for a sparse entry, but it didn't really solve any issues. The caller still has to check for whether it's the empty node or not, it may as well just check for a NULL return instead. The dummy_ubuf was used for a sparse buffer entry, but NULL will serve the same purpose there of ensuring an -EFAULT on attempted import. Just use NULL for a sparse node, regardless of whether or not it's a file or buffer resource. Signed-off-by: Jens Axboe --- io_uring/fdinfo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'io_uring/fdinfo.c') diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c index 9d96481e2eb6..8da0d9e4533a 100644 --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -178,9 +178,14 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file) } seq_printf(m, "UserBufs:\t%u\n", ctx->buf_table.nr); for (i = 0; has_lock && i < ctx->buf_table.nr; i++) { - struct io_mapped_ubuf *buf = ctx->buf_table.nodes[i]->buf; + struct io_mapped_ubuf *buf = NULL; - seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->ubuf, buf->len); + if (ctx->buf_table.nodes[i]) + buf = ctx->buf_table.nodes[i]->buf; + if (buf) + seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->ubuf, buf->len); + else + seq_printf(m, "%5u: \n", i); } if (has_lock && !xa_empty(&ctx->personalities)) { unsigned long index; -- cgit v1.2.3