Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4002439pxu; Mon, 12 Oct 2020 07:06:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqm7RcAe+C+DNiJsCA2fDLRHWmW4pkYPRF0GrJrsLGgrGszZQdPWDK5WZrp8LvVkpDfnpt X-Received: by 2002:a17:906:3cc:: with SMTP id c12mr27571885eja.216.1602511605642; Mon, 12 Oct 2020 07:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602511605; cv=none; d=google.com; s=arc-20160816; b=0DkOc3hcd34De7PQvAfblAbMmTBEHdTR3/NjhRoPfJ9+jzTfIIt1GS/+9U5PFmTIxu NYafS0juM/osMjpai9HVfQ00m9sjAkHlIiuqtScl9iY8luNQvJOx00MBnK4kKq0tOFop 3XPrMvrHKz+S0gVzLFpGHyauUIi8FRRyKQOWyqv37Pm22C6071xIEQEAdITfMcWgv5uL 6DUZnzDUMEeZXU2AWD4wC8zjKhobbqPwqbWQJuPOH6zycojWlKv74gcc31EqFd1Z0hvA Uddj6012zmuzvS7ivCpAOYOgxblY1HS/88X57IVGR3Gb0/CdvRtxF1cDkZZ6M5Fsm/WL empw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=f0TKsK1wlFgo0+VuVbjQ20bSEZV6x2sMsaxV+FfDD28=; b=vU3PN1mV0a5F7X1Ks/2k+/TQOcmd1WaLPrKw2i4Wd7smpNFwkqOTCl+AXQ1oYOeEJM I+eTBZavJ8mvtKgj8uBTpfcar96grk5BbxFm7QQXkGWsXNea7akhviax0t/31/SYlGrV mm9A2mFSEIsC0bBiW008pXYBnn6+U7wQvF+/fkOWd9VyvLw6V7Ovzhn+mxuQxaxCGwuZ jodUG+AFXpIP4xy5nKYLKP0BYSgPNeIOFZS+1eqQdwPPMw4j581U/uZpwGN+g3ypJHb8 hG4rSmbyD1FRlIR7rTuZYUJNtF+dd4oNMpn3ws+P+7mF9ww0bQ03B/d5B2uV3A9j5Ksw cQgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu10si12224564edb.54.2020.10.12.07.06.21; Mon, 12 Oct 2020 07:06:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388608AbgJLOEc (ORCPT + 99 others); Mon, 12 Oct 2020 10:04:32 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49861 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730766AbgJLODo (ORCPT ); Mon, 12 Oct 2020 10:03:44 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kRyQP-0003fj-Cq; Mon, 12 Oct 2020 14:03:41 +0000 From: Colin King To: Alexander Viro , Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] io_uring: Fix sizeof() mismatch Date: Mon, 12 Oct 2020 15:03:41 +0100 Message-Id: <20201012140341.77412-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King An incorrect sizeof() is being used, sizeof(file_data->table) is not correct, it should be sizeof(*file_data->table). Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)") Fixes: 5398ae698525 ("io_uring: clean file_data access in files_register") Signed-off-by: Colin Ian King --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index b58169240c77..6b30670fffbd 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -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; -- 2.27.0