From mboxrd@z Thu Jan 1 00:00:00 1970 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 42772C05027 for ; Thu, 9 Feb 2023 22:50:56 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qTdPZlJh5kn83/yXvb4N2aITA5kZUcWPWcJglXOph0A=; b=lUy2O7yIOYo1t6 mat1y7HW9eEQIsecagieVkJnIo3RLi8TXnN/nctm3sXnd0Wl5rtp0DhqDSEi8Rr/kBS6diCbjt3U6 1OG1/7VDVd2GR+s283Bxqah6AmPShz3B9yv8nILNmpX5A5+XO20qRqakEMTLGh3LhhRmGqmtH5TJn TBWdGVGtBa4LCUgalVXxENLKqPhAw0LRnh1pXCXx9SN1rLKVl91yc3ylCjkFobFkGIxRnNZjuVg8w VEFoj6tvU5JDbIc2ddPjoswRrgnSy7gsmULi1hm5p2eb0gyy5HtPSaIsOzgJeyOka1lMrZQV+IopA Cdew2aecob7QWlpogb9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQFjn-003RWL-Ep; Thu, 09 Feb 2023 22:49:55 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQFjj-003RVS-Hw for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 22:49:53 +0000 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 77FACFF805; Thu, 9 Feb 2023 22:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675982986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Lnvtyk9aeHwFjeMnZfCC53dWohWwbHsKqzFVtpNGRYY=; b=B+TTLo7qiAp2HGaN2AVJrlbifCRg1l7HsMHwDVeSx5Iwx3s9v6hzut3xSOnTfWHn6CYy/n jbRIzx1Y2kkEqiwnmGtqI/45a3BA1JNHvsPT4DG+ATjvCCsUdtyxF27LKIDCDXlO8syEGX CjG7OTrCV7LewTmAsP58jI7Y70ONtv4NptspdDdBmnoKSpPjpCwEoy+sDHzr3tZShC3/oJ fdW4EB3fwfQPYS2UOzmgbIr2EtjJpEtGJfgV/QYW3AbA9BsxJJYKKqp/CzGrCJ9hhnnmNk E3I52P7/9Q2x4D3W7QUC9Y6Phq118ifkXHyCYA0bLJAcde7ootsmrXpdJ7F9WQ== Date: Thu, 9 Feb 2023 23:49:44 +0100 From: Alexandre Belloni To: Samuel Holland 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 Subject: Re: [PATCH 1/2] rtc: sun6i: Prevent an out-of-bounds read Message-ID: References: <20221229184011.62925-1-samuel@sholland.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221229184011.62925-1-samuel@sholland.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_144951_764514_5C4CD4CA X-CRM114-Status: GOOD ( 20.36 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. 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 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel