Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13031172rwd; Fri, 23 Jun 2023 14:37:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4sxrXclEaSlWM05cgfZSgzxd21DBUb2DwXrNwyGX/19Favr1mkuvP6CWfdJY/frnNtqZO1 X-Received: by 2002:a05:6808:1185:b0:39e:b834:1859 with SMTP id j5-20020a056808118500b0039eb8341859mr19967444oil.29.1687556258788; Fri, 23 Jun 2023 14:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687556258; cv=none; d=google.com; s=arc-20160816; b=kOmJbun0YGOBqvIlVOrwM1ciWRrTCGKnGFJi0JVUQ7wIxvBKYJpoYLFA9lByt3KBVp wcXaBgxcnGVbpdmF6B1XOCYiqaIF8Q5VutLRaPgJrrFSCv0UeXc+uAaA3RR6OyTayVr6 NkRmY9KT6zYBREaoRjhezAKkk4rnRElWr2e8/4SQ3jxhtjcmSqfK23ZDPc8uaoP9MEQU aBZ5Omx+Sk5yQD6DRuYhkDMSpQUpwha6RP12yjmOc7+POApMQjRVUz2Si+Q50TOws5Ph 7keoHe00uNnoLL7WcnuiTHCgsrqpPhQ/EjBM25/Xi0WKvk6NigacTTgx242UdK0It7Y0 E0HA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QJydWjDhcLcynf/rTVoWViPI3W7kgehSdj6sywGYPic=; fh=v748+a5v7zsNoeZ4C+RGwK7AELp2QIWr0P1GpREhaNM=; b=nC5k8dc8wpuOC1VD6RoWaCJtiXcHkOcHgSXZhrS+xmiXY4PeEHPcOVRPhKOvPBZO/K 8mztnvoQ7N5b5G3HBlsoAnhnbF2YPaeSJp43IAPlvEgmUs9jiIDwtbGmU8dZLc4/fTfK tMYKuOJdQ7EEo0xp5f32tsNtwJYZT7D2wY3eTAAdXGu9oylyb3IVSamZEAjxJFStEodG bo1AXa4dBUZ1YSJk3LJc79WH5ecAy6fNvEQRS4Mx+830mqRmP/dfv6kU/YwGxdlh3q2f VfcIEzC2q/7jFulqeM4AlCTpSpqoX5TfU7BiuJd+KQthtQnZPx/zgUrIfsC6h8sJJAXY OCPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=X2xeK3QM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa2-20020a17090b4fc200b0025690b76c95si412648pjb.10.2023.06.23.14.37.23; Fri, 23 Jun 2023 14:37:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=X2xeK3QM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232848AbjFWVP3 (ORCPT + 99 others); Fri, 23 Jun 2023 17:15:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232386AbjFWVPR (ORCPT ); Fri, 23 Jun 2023 17:15:17 -0400 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F786E65; Fri, 23 Jun 2023 14:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QJydWjDhcLcynf/rTVoWViPI3W7kgehSdj6sywGYPic=; b=X2xeK3QMt9anv3maJ1FcmZls+/wbC9tReX04ZeglJ8Tk/S/H1TRdiR4A N+T7YWnS5GqgRHq27/dWmJRtK5fZ7cwk083jSAk70KAam3mJz1yph40Bk np73UEzsOMOdKfYhMSymqaeTbOBQD/p+RhfoGUUicKqk24X4ASAYRe3pU s=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.01,153,1684792800"; d="scan'208";a="59686165" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2023 23:15:11 +0200 From: Julia Lawall To: Satish Kharat Cc: keescook@chromium.org, kernel-janitors@vger.kernel.org, Sesidhar Baddela , Karan Tilak Kumar , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/26] scsi: fnic: use array_size Date: Fri, 23 Jun 2023 23:14:38 +0200 Message-Id: <20230623211457.102544-8-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230623211457.102544-1-Julia.Lawall@inria.fr> References: <20230623211457.102544-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use array_size to protect against multiplication overflows. The changes were done using the following Coccinelle semantic patch: // @@ expression E1, E2; constant C1, C2; identifier alloc = {vmalloc,vzalloc}; @@ ( alloc(C1 * C2,...) | alloc( - (E1) * (E2) + array_size(E1, E2) ,...) ) // Signed-off-by: Julia Lawall --- drivers/scsi/fnic/fnic_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index f3c3a26a1384..74d428c9f7d3 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -465,7 +465,7 @@ int fnic_trace_buf_init(void) fnic_max_trace_entries = (trace_max_pages * PAGE_SIZE)/ FNIC_ENTRY_SIZE_BYTES; - fnic_trace_buf_p = (unsigned long)vzalloc(trace_max_pages * PAGE_SIZE); + fnic_trace_buf_p = (unsigned long)vzalloc(array_size(trace_max_pages, PAGE_SIZE)); if (!fnic_trace_buf_p) { printk(KERN_ERR PFX "Failed to allocate memory " "for fnic_trace_buf_p\n");