From patchwork Wed Jun 9 08:01:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12309291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F15C47095 for ; Wed, 9 Jun 2021 08:44:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BEE7A61375 for ; Wed, 9 Jun 2021 08:44:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEE7A61375 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=qcOZeG3sr6xF99JR1haxllDpFyP88C9MAYzCoW+eenU=; b=i0eJzl8koufPeU 8/nSxUAwwaN0nGVjePkAjlWSJzT0ZsM7PbN2rFioy2f6JgiLt7QyO+uW+xmaOaK5NejSxv62USG0u 2vVpPuaraYh1sgbn604JHed8KqYbk+Af9vQUjmDLZ88BP+n/hpJgLKyvRPS7KcPLcRvKnvM91CQM+ 3pVTup7Yw6Vth4qRI5zKwYQpPoGaiO/ypYnazsoqZvqwGY36E+GpRUXTVv3D6UGoPncOfDAloZ7mo Ty+5Vo7mXmSsN/FG1UZc3sDClsZeqNF4Snz4qoPHVep8VhHYqsQ5+C/nkBQLb9mCFB6At9sgWpJUb 3MfsCc74kbpWFmB7ok+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqtl5-00CPwd-D3; Wed, 09 Jun 2021 08:40:20 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqt9q-00CF7i-Ie for linux-arm-kernel@lists.infradead.org; Wed, 09 Jun 2021 08:01:52 +0000 Received: (Authenticated sender: clement.leger@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 6005260014; Wed, 9 Jun 2021 08:01:45 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Michael Turquette , Stephen Boyd , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: at91: fix count of periph clocks passed to pmc_data_allocate Date: Wed, 9 Jun 2021 10:01:44 +0200 Message-Id: <20210609080145.44226-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210609_010150_787410_242BA651 X-CRM114-Status: GOOD ( 11.07 ) 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 When allocating clk_hw structure, only the periph32 clocks are considered. Since sama5d2_periphck are also added to the phws there is currently an out of bound write. Fix this by adding the count of periphck to periph32ck. Signed-off-by: Clément Léger --- drivers/clk/at91/sama5d2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 3d1f78176c3e..663b73a032ee 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -170,7 +170,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc = pmc_data_allocate(PMC_AUDIOPLLCK + 1, nck(sama5d2_systemck), - nck(sama5d2_periph32ck), + nck(sama5d2_periphck) + nck(sama5d2_periph32ck), nck(sama5d2_gck), 3); if (!sama5d2_pmc) return;