Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp640187lqt; Thu, 6 Jun 2024 13:51:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUVC/2Dde+ZZvEpWMBVg2AC/pECLnYiOFWRAs7vJdDfC1nsPs+bbVq7x0T6zMKQ4L0/AgPnyJH7rKjndvNYClbc+6JkGxI307H1H88r4Q== X-Google-Smtp-Source: AGHT+IG3l6BQjA4YyjHY6WWl7vGMDlNfhqEUiU3afHVgKl8ild73X/ym12eYt3T0UJ6b6m6J6OMj X-Received: by 2002:a05:6358:6581:b0:19c:5226:e2b0 with SMTP id e5c5f4694b2df-19f1ff99ccfmr116380255d.24.1717707107888; Thu, 06 Jun 2024 13:51:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717707107; cv=pass; d=google.com; s=arc-20160816; b=AYB7fsIeAeSYAA8a4947vIBtYYv56mX3KZIUtg/KZeg74IQF1quz8SpuLX6nSL794h w2NJfcPo1eflK+6YRSAMpzi/ZoQSflJMNC/4y4gYIUCP5S8jHq7cK92KPEIjcx0HF3jk QZ8nj8P1s1KS1/jmfu287nNtO2ku5VNe1QoqX+X3FFt9QA9igaUNaQhAF/b5Kxs9NjaC hTran1wYDGZ3ea7gdnXf4NPD8lvHU7eykWK8IJ3p91q/9gf+nOosvAgMg9jaERpdUb0p 2dUGpHvGvrK+bFvFC/abf3369/Sl4JNVEjQGodG/YqruzMjbzFuaxJjgR7KUtFOrZN1y 0EGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=uijz2Cjl6yD2T9wPg0u4LqIiHDMS9X0hYZ6i37S2UVw=; fh=mwmdnzVlc8nJm0YQESIMN1oIGDwcwtqoklSq/U+fFMs=; b=LHbibqJR09hO2PkkhahA3nthwiqritkrL3A5VWmJhQNbeBZxWRoXIlJeL9DquHMK0M 2fNp0dsJp/VPLSDYFNmcM56YxqbalfBgvh86FN6dDDAbgq44jGP4Qeqllyw/o71tyw7h 5J70Yq3ivbTSjTXixyjOs4YWMdMpoBGu1B/tsfnX9V/or4yi8vBlQA3W8dF730/aJmQV EkLTZmU1GAiy1B5Pp1/Z/Tajvog9iETOYZCrzHvgwqfakXwcPVlR2Ek6zYZZmJZDO24z 2B3bxW9bPRg6BBvKjhmyy1HDJpPuWYn4GkEdwaPRanKSCDEoIeVmt6haTvzVxz0Kppjn oCcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Jitzm3Gs; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204732-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2a377d4fsi1675038a12.807.2024.06.06.13.51.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 13:51:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204732-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Jitzm3Gs; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204732-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4D10828E9DB for ; Thu, 6 Jun 2024 16:50:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71FC5198E99; Thu, 6 Jun 2024 16:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jitzm3Gs" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FB53197A8E; Thu, 6 Jun 2024 16:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717692611; cv=none; b=RqIjey/F/6HdjTiJBTfyX3aL81Cc6QSjoRh1Kl9L81p2wM7hnh84GQuCbt28LItXkbvL6y5U0DLgcnf2y9/yGgoLqUBzX+rUp0c7rFEZPEXvf50tVPGS++pobnM2T8LI9ya5TxsM0iD+n9oU2wb3JHHKX6H4MOBLE5PFZDdPsaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717692611; c=relaxed/simple; bh=tlaOqTIhOPntNJcdksoYStm3FquF+/nT90DemPfbmLU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dwAbPpkkpAQL8lqJSUt09zQfSuMJVWTUOaRQgNAr5tuW5XePmxKJyT4V+pxuZQdrwzy4V1Rno68VuBM+rb8P7KFzG7eBZof9oQ4/955JkXdeGOn++5xsnSyPnYWobDn1G3Xv2HH+dwb0TWSOBq0LVWwznj+4X3o6rYHScXnZ4ok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Jitzm3Gs; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717692610; x=1749228610; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tlaOqTIhOPntNJcdksoYStm3FquF+/nT90DemPfbmLU=; b=Jitzm3GsCl6kzm+nW9yLofnKXeVevHjqh/d6nANLexGmI4bJ2+tU9ih8 HqnyfZclH2EMEuxK4Lfe3NaeICYhHgjy0UGF82oktEw751uHaEGPyINNX 5rspd2i2poAzT1ZAK74f6HlVAH1bXd1/IoPwTwsj/iuD4zM4NyLZHRKlv K4IZ2cKSw/xmlZ4UUTZ+kfkwgQEb31V28P56Bo+Q6o01LX70Swh0hvK+C 65csc8i821tlIYtyx3XybD4QaAGLRVJzYM4i0Mxb5HGCc7GALiuucL+UD gi4Nj6JuMoJDf5gAV2J3yw0Z8i/4yajLS0XB8YI/ke9lKCyzavdtSF10z Q==; X-CSE-ConnectionGUID: IASmFAx7TReJM+cnQmEFsg== X-CSE-MsgGUID: 9aFuuGaVQcKBR/G7/LIWlg== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="25009192" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="25009192" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko --- 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; -- 2.43.0.rc1.1336.g36b5255a03ac