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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E77DDC636D4 for ; Sun, 12 Feb 2023 21:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjBLVLa (ORCPT ); Sun, 12 Feb 2023 16:11:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbjBLVL2 (ORCPT ); Sun, 12 Feb 2023 16:11:28 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 490AC1115F; Sun, 12 Feb 2023 13:11:27 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id B74E75C00C8; Sun, 12 Feb 2023 16:11:26 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 12 Feb 2023 16:11:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1676236286; x= 1676322686; bh=/BkqxOtXcZA548SCvbOvOHi/XeQIUpilhd0t/wMeQnw=; b=K uLKSf3DtAmqKfbtNpo3a5/dMq4CUYH5ZaBNBvGZA1tTwEKbZBMTD+h1i4s6Wi7Bq +YPYUjmGk7gHmHn+/GxrlwHlPUD6a6V0G5tC4Zgg0IelnvWWNqCcS1/5IoBroNGh l8vZyEp+XjPhsfOPflDUszUlzyCobhLnnoM34RMnsvIMfwgI0oI1X//wW/f0tXE+ wUhIECoaOZ5jPe37BfMCEVrOg7IM77my2cL0sRp9g26m692yInvc6K+qzh2FXLF5 qYkI6JnrjcOa+v1AlLYmqYTjPEi9sVosIgeltRRMl7NtC/mewJIgVQBYNMLOFxdi gnu68yDbaNXQ3lzFVeLSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1676236286; x= 1676322686; bh=/BkqxOtXcZA548SCvbOvOHi/XeQIUpilhd0t/wMeQnw=; b=t dyMqsPxMjdYBCd6+tf5abiJwml3YyRuaaTYNS8eaYPLB40W+Hfnxj0lsM+U0S1rP H+PG+VOtR2VVaCpwb4TJSNikPMorNEXjjQlndGrHhQie+wRCV2nDbbLtPwVpx5G0 HNmiQnOpb924Bgu4WUrpnZP6YbABiDFQev0aXxomtQaWp+EpOzrL+KXjqnfsOrET HrYk/TcTQduUqhybRNzgKSF8W9JTAfh42c4tIpfYQ2mJau3/AKudxkS7BIhTmO2q 3IzqDe6hLPATOuAG/6qKuRJwQa7HIGHvH2y0ccrX+YB+DiadsT3rl7HVy420337u audEIiyuJfqBauD1zcczw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehledgudegiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepufgr mhhuvghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqne cuggftrfgrthhtvghrnhepkeejleelfeeitdfhtdfgkeeghedufeduueegffdvhfdukeel leeftdetjeehuddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Feb 2023 16:11:25 -0500 (EST) Message-ID: Date: Sun, 12 Feb 2023 15:11:30 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux ppc64le; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH 1/2] rtc: sun6i: Prevent an out-of-bounds read Content-Language: en-US To: Alexandre Belloni Cc: Alessandro Zummo , Chen-Yu Tsai , Jernej Skrabec , linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev References: <20221229184011.62925-1-samuel@sholland.org> From: Samuel Holland In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/9/23 16:49, Alexandre Belloni wrote: > Hello, > > What should I do with this series, I'm not sure you came to an > agreement. > Also, 2/2 doesn't apply so you'd have to rebase. I will send v2 after the merge window, possibly including only patch 2. Regards, Samuel > On 29/12/2022 12:40:10-0600, Samuel Holland wrote: >> If there is more than one parent clock in the devicetree, the >> driver sets .num_parents to a larger value than the number of array >> elements, which causes an out-of-bounds read in the clock framework. >> >> Fix this by coercing the parent count to a Boolean value, like the >> driver expects. >> >> Fixes: 3855c2c3e546 ("rtc: sun6i: Expose the 32kHz oscillator") >> Signed-off-by: Samuel Holland >> --- >> >> drivers/rtc/rtc-sun6i.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c >> index ed5516089e9a..a22358a44e32 100644 >> --- a/drivers/rtc/rtc-sun6i.c >> +++ b/drivers/rtc/rtc-sun6i.c >> @@ -294,7 +294,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, >> >> init.parent_names = parents; >> /* ... number of clock parents will be 1. */ >> - init.num_parents = of_clk_get_parent_count(node) + 1; >> + init.num_parents = !!of_clk_get_parent_count(node) + 1; >> of_property_read_string_index(node, "clock-output-names", 0, >> &init.name); >> >> -- >> 2.37.4 >> >