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 1C9FFC433FE for ; Fri, 28 Jan 2022 10:19:50 +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=3K8jVN27ukTQyL78midBZkyDRBe4jdryONuyj++aEFI=; b=rPzX2rloFLUOy3 mGffUfwrVHkXJIfm/dkAkpe318+FntEExotYzS70ktnxOhqjdLwxjrxBJUveWOXOlnuOLkchhYtcl mnaopwl4K+4z9xe+21OwI5XplpqOnQGykRFXuTstT6WyZiX16hVYNUsF/ASAQUMiHSh/S1pUbgh06 /RlKEEtEofi5nYFHNUrC4nkum8o1rfo5U6AZpAXmJAREPQ4Zf1GJTcNmK+PTICN7RXnV74wce0tSD Z2J+1e1RecQ+/bqILEfrWP75d1oqTPiUxED9/ZIJ/n3Z4u3EsdIRlTHu/duFg2RMXngYdXY/6RtCQ DLZokYzE66sOXBVISLVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDOKY-001Qdn-42; Fri, 28 Jan 2022 10:18:11 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDOIs-001Q2Q-DX for linux-arm-kernel@lists.infradead.org; Fri, 28 Jan 2022 10:16:28 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0867DB82518; Fri, 28 Jan 2022 10:16:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09B43C340E0; Fri, 28 Jan 2022 10:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643364983; bh=AtryLqdfbP2bIln80y7o32pcX0GHQcTsCpCHopwzoaA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pn5jTamHjupkOw2EA3/yJptuMJNs3Xifhj0g2lj1WVKw7S0TdpTWYfvp0YH+lczZM x6SSsd8UBu2y/+mfUslNcEaVzH8J/q80kBqN/DYZTdUJ079em/VeyWwceJmkT69xfm EUQYvt6JMa91tdukdRPuaXflMhYE/tCc18XLamN8= Date: Fri, 28 Jan 2022 11:16:20 +0100 From: Greg KH To: Zhou Qingyang Cc: kjlu@umn.edu, Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Adam Ford , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: imx: Fix a NULL pointer dereference in imx_register_uart_clocks() Message-ID: References: <20220124165206.55059-1-zhou1615@umn.edu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220124165206.55059-1-zhou1615@umn.edu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220128_021626_642284_EC81F3CF X-CRM114-Status: GOOD ( 25.49 ) 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 On Tue, Jan 25, 2022 at 12:52:06AM +0800, Zhou Qingyang wrote: > In imx_register_uart_clocks(), the global variable imx_uart_clocks is > assigned by kcalloc() and there is a dereference of in the next for loop, > which could introduce a NULL pointer dereference on failure of kcalloc(). > > Fix this by adding a NULL check of imx_uart_clocks. > > This bug was found by a static analyzer. > > Builds with 'make allyesconfig' show no new warnings, > and our static analyzer no longer warns about this code. > > Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout") > Signed-off-by: Zhou Qingyang > --- > The analysis employs differential checking to identify inconsistent > security operations (e.g., checks or kfrees) between two code paths > and confirms that the inconsistent operations are not recovered in the > current function or the callers, so they constitute bugs. > > Note that, as a bug found by static analysis, it can be a false > positive or hard to trigger. Multiple researchers have cross-reviewed > the bug. > > drivers/clk/imx/clk.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c > index 7cc669934253..99249ab361d2 100644 > --- a/drivers/clk/imx/clk.c > +++ b/drivers/clk/imx/clk.c > @@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count) > int i; > > imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL); > + if (!imx_uart_clocks) > + return; > > if (!of_stdout) > return; > -- > 2.25.1 > As stated before, umn.edu is still not allowed to contribute to the Linux kernel. Please work with your administration to resolve this issue. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel