io_uring: Fix sizeof() mismatch
authorColin Ian King <colin.king@canonical.com>
Mon, 12 Oct 2020 14:03:41 +0000 (15:03 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 17 Oct 2020 15:25:41 +0000 (09:25 -0600)
An incorrect sizeof() is being used, sizeof(file_data->table) is not
correct, it should be sizeof(*file_data->table).

Fixes: 5398ae698525 ("io_uring: clean file_data access in files_register")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 2e1dc35..717dd5d 100644 (file)
@@ -7306,7 +7306,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
        spin_lock_init(&file_data->lock);
 
        nr_tables = DIV_ROUND_UP(nr_args, IORING_MAX_FILES_TABLE);
-       file_data->table = kcalloc(nr_tables, sizeof(file_data->table),
+       file_data->table = kcalloc(nr_tables, sizeof(*file_data->table),
                                   GFP_KERNEL);
        if (!file_data->table)
                goto out_free;