From patchwork Thu Jun 6 16:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13688813 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 ED051C27C54 for ; Thu, 6 Jun 2024 16:51:27 +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=LC54bhSD5irhfwBr9zj6P+O0KF5jpIzVr98EdN2MDgk=; b=cWCdyMHlQt24GW SjD7/co6nnTgzJcQwht8b8v9Qgp5oZPgTqtC3mnBc+safB7jUSPZIwVRjHVBCUju+JvIkolrLZVJZ 3KZEjrr0217uEj9uNe/XcmbIBwxFT6hGu3vGVMow+3oQHlisSwmER4E2hS6PbYeuu9ozaXlfgUdSl soD1wsx29r2ZbDPblFqY/cvnTg1TYeOJc3ym5duFh1qMN8B0iYDEdrd3AWbXhMIGYghJ8I93GMDOf BpOJM7MZq/mvN/2vEthgPFXBKNpu/DzdGPrzlt3x1tVImNurjONT8fISvnQ7O1AMFFdNQX0ttL7hB +s0a0f766lwbO7cZhxLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFGKX-0000000Aaxh-2vAu; Thu, 06 Jun 2024 16:51:13 +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 1sFGKU-0000000Aax6-445q for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2024 16:51:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717692671; x=1749228671; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=mU0GEeJExfu4WFvL5Dq9VO5VIFqHpZfWtvi7arJG77M=; b=kPzhtYHB6SGZZ9v5bj9SofHKaXe2A5KjsAYScigKH0ZG+hNsWheK3Mrg NBpahdRNXSY1KNtxvZpMrCB5HMdKBel77ESxwXxSfrN/Oc48EKE3nzBJW pPw/OG3yy3rhhaxZ3w2hpmd6wl/WjWuPR0vpzgF0V1m2Je+EvkG1t3PuH Ly7Oj579OSVC97bqAVVTddhmhB6dzjAEy9dMoSKfDoopQ65P79Lbq7m9r LS5WDOoCA84LS3fkb+LuAt8EY6fSd7h3bsM21WKWtqyFqpit6Z0MfKjTT suZ6Fu3py4zjuvQKB6QiCmZw0BiGfx8RNI6A6WdqYWR3+VkatmWgSzX/q A==; X-CSE-ConnectionGUID: ymNHkt1PRxWWT7Pfef5Jvg== X-CSE-MsgGUID: slHtALfYR8SDCz8OT7sqLA== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="25009371" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="25009371" 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:51:10 -0700 X-CSE-ConnectionGUID: ZB5/aMQGR4GBY5auLydIdA== X-CSE-MsgGUID: u5OO8FzUT7yoPx5KkQPwBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38591945" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa008.jf.intel.com with ESMTP; 06 Jun 2024 09:51:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EC8E52A4; Thu, 06 Jun 2024 19:51:07 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tony Lindgren , Russell King Subject: [PATCH v1 1/1] ARM: omap2: Switch to use kmemdup_array() Date: Thu, 6 Jun 2024 19:51:04 +0300 Message-ID: <20240606165104.3031737-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_095111_035121_FB508941 X-CRM114-Status: GOOD ( 10.91 ) 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 Reviewed-by: Aaro Koskinen --- arch/arm/mach-omap2/omap_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index fca7869c8075..800980057373 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -315,7 +315,7 @@ static struct omap_device *omap_device_alloc(struct platform_device *pdev, od->hwmods_cnt = oh_cnt; - hwmods = kmemdup(ohs, sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL); + hwmods = kmemdup_array(ohs, oh_cnt, sizeof(*hwmods), GFP_KERNEL); if (!hwmods) goto oda_exit2;