]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring/kbuf: drop extra vars in io_register_pbuf_ring
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 13 May 2025 17:26:48 +0000 (18:26 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 May 2025 20:45:55 +0000 (14:45 -0600)
bl and free_bl variables in io_register_pbuf_ring() always point to the
same list since we started to reallocate the pre-existent list. Drop
free_bl.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d45c3342d74c9030f99376c777a4b3d59089074d.1747150490.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/kbuf.c

index 344517d1d921a055c621a810c674d860f0925f19..406e8a9b42c3f983f58ec3c8a0d3a3258ce2da98 100644 (file)
@@ -591,7 +591,7 @@ err:
 int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg)
 {
        struct io_uring_buf_reg reg;
-       struct io_buffer_list *bl, *free_bl = NULL;
+       struct io_buffer_list *bl;
        struct io_uring_region_desc rd;
        struct io_uring_buf_ring *br;
        unsigned long mmap_offset;
@@ -620,7 +620,7 @@ int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg)
                io_destroy_bl(ctx, bl);
        }
 
-       free_bl = bl = kzalloc(sizeof(*bl), GFP_KERNEL_ACCOUNT);
+       bl = kzalloc(sizeof(*bl), GFP_KERNEL_ACCOUNT);
        if (!bl)
                return -ENOMEM;
 
@@ -665,7 +665,7 @@ int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg)
        return 0;
 fail:
        io_free_region(ctx, &bl->region);
-       kfree(free_bl);
+       kfree(bl);
        return ret;
 }