From patchwork Thu Jun 6 16:50:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13688812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AB29C27C55 for ; Thu, 6 Jun 2024 16:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XElBnDvjMgIoVxr+OP+bjKdO0IVC5Frjph6LITmp3hY=; b=L7Z+ZHjbY1nlzu InLreH2xN5r3iY8tbWu41zvhMIwQqfScm4/vlErdc3g1GMyiBXb4VGknZdo599B+s0DHVzd1fhLAn SUkz0baiQM1Luv8lALThmMkowhKNBQCe0pLLG51JBmYAXzCmkU9JxdgkY1rCd41eFFg6tpVD2cJLd PvmaaC0SrvmRgjgGCj/LxkRYEt27PsOC+e9TLmZVukFu7azNMtNZ41dmSU+wbGVvRWS3sGU8ZCdyU vmUF2mOt4cypI4S4CkbNG4nrQScgAChYGrFvc14X546WBd2NqxuYCtobJjAhpqnKvK+f8k3+D5nCo yIPBNSSscz3MjHyhTGZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFGJb-0000000AaiP-2UqF; Thu, 06 Jun 2024 16:50:15 +0000 Received: from mgamail.intel.com ([192.198.163.11]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFGJX-0000000Aafe-36le for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2024 16:50:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717692611; x=1749228611; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tlaOqTIhOPntNJcdksoYStm3FquF+/nT90DemPfbmLU=; b=e+ZJC5rGW9ipxpKwI37R7v5q4PiNvx+8xx2MbRa8ulrd3qtrC2EcEsDX 9RTfAQcihCieQfRIwaNlL6VcgM/RnPWQN89Rl/Y1ZJd9JN7W4NQwrAe1G A3uj+4UGiW2IXm4GGNGheeOVwJYnS2Hd7aOtMeBqvmApLLsoQdzw7A4yR 0wMg90xjifOmQM3/q3+qBP/A4FQvorcVQZHvIIs6zyfPfpYPuwbN8xw8D cFhUo0UDrf8mPRdRp5MzF4GUk4lyravVW1wS2fO/6m0kmJ0JtK37+e/BD o3s7lC6cVO5nMNWs5RaHBN5R1vf4ewUNxSnl3FunFzC2g+LW/gtJ2dmi0 A==; X-CSE-ConnectionGUID: 3/M9qcdJRee5D23F+sbUHg== X-CSE-MsgGUID: VrmCVVfJTJq/Cbp4ke/rkw== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="25009196" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="25009196" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:50:09 -0700 X-CSE-ConnectionGUID: DdXhLnLjRm6K4xL53TTMzg== X-CSE-MsgGUID: e8p8eG7JTEmDCX/ObJeFsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38591644" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa008.jf.intel.com with ESMTP; 06 Jun 2024 09:50:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1AF702A4; Thu, 06 Jun 2024 19:50:06 +0300 (EEST) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 1/1] ACPI/IORT: Switch to use kmemdup_array() Date: Thu, 6 Jun 2024 19:50:05 +0300 Message-ID: <20240606165005.3031490-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_095011_900115_8C36C0B2 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko Acked-by: Hanjun Guo --- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index c0b1c2c19444..e596dff20f1e 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -822,7 +822,7 @@ static struct iommu_iort_rmr_data *iort_rmr_alloc( return NULL; /* Create a copy of SIDs array to associate with this rmr_data */ - sids_copy = kmemdup(sids, num_sids * sizeof(*sids), GFP_KERNEL); + sids_copy = kmemdup_array(sids, num_sids, sizeof(*sids), GFP_KERNEL); if (!sids_copy) { kfree(rmr_data); return NULL;