Message ID | 20230623211457.102544-8-Julia.Lawall@inria.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6054584vqr; Fri, 23 Jun 2023 14:40:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4oizOtYwBNeqKI0xpRJimI56srBaDUTL0THKmQjfs4WsjH98lM5Xa2jr7g3saAiT3kWnhY X-Received: by 2002:a17:90a:fe0d:b0:256:4217:b955 with SMTP id ck13-20020a17090afe0d00b002564217b955mr20082346pjb.35.1687556404281; Fri, 23 Jun 2023 14:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687556404; cv=none; d=google.com; s=arc-20160816; b=YcczQr38hCEOXGKwlEBXGdPjMQROj0yGapKVCuRNb408NztZuP2Fiufzi2hqqW6YnQ AFCeCdvKA+/Nz1EUQtiEHuBX6dQcsxvXnmhfu6N2RvfIeKh0MoYVdD1/+fKLWZb68pY2 i5wT9mZdaQA2Hg8/JQkrqaUVIfeEZx1mkWEmQ1QDsqouTGXgoWHSItQMd3wJkFO3eAhK cG/KLLxmh++9z3C7B6xx5O3pw2GguGWxiQZhs0g++UC6fNmb9NeG4b52YM3dtmxxTNay lFV8VIckPjfYm4uZ6VIaidsOACTA+MswyS6UzXtOvdV1xBemH2dh3DA1m/Tb2qYMNDl5 251Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020a17090ac90600b002536c5eb7cfsi2611108pjt.58.2023.06.23.14.39.51; Fri, 23 Jun 2023 14:40:04 -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 S232833AbjFWVP3 (ORCPT <rfc822;maxin.john@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <Julia.Lawall@inria.fr> To: Satish Kharat <satishkh@cisco.com> Cc: keescook@chromium.org, kernel-janitors@vger.kernel.org, Sesidhar Baddela <sebaddel@cisco.com>, Karan Tilak Kumar <kartilak@cisco.com>, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769531144489634969?= X-GMAIL-MSGID: =?utf-8?q?1769531144489634969?= |
Series |
use array_size
|
|
Commit Message
Julia Lawall
June 23, 2023, 9:14 p.m. UTC
Use array_size to protect against multiplication overflows.
The changes were done using the following Coccinelle semantic patch:
// <smpl>
@@
expression E1, E2;
constant C1, C2;
identifier alloc = {vmalloc,vzalloc};
@@
(
alloc(C1 * C2,...)
|
alloc(
- (E1) * (E2)
+ array_size(E1, E2)
,...)
)
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
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");