From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08D3F1607A7; Tue, 7 May 2024 17:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715104707; cv=none; b=VcEJo5OG64Byg/B+LRu1aDj0j42JThpXToWPwdxmABBNdecETfyCN2kORzY1ZtvKVBBPXHyziSPnOYkgI2PP6oIojhu4TWsWGml1uB59jieWpqHCcB2DhwRqTD05MjTMx9OV81WEO2z9zbOwd2f0+CN4owX+i2uXkTah0Jd+60Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715104707; c=relaxed/simple; bh=cLhYMUfavX/is8oPA4vFjuYUvx4gHjw9s6GruuvD9E8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ceL2kv0ndzEKBWJ1aBZ92mH1vUOch7doof66vQ03WAJbYhDFqioEGP3ytwEPyV0X/uLz0TbzmUVNaj+uBydU/JZsOsiSY8a74AKgRc4QuTWxPk8K/dmyxkhzCuEo191QWQ6AybOzmpP4Ia6fhoMc5FlY8jzmZ0pkO7Afau7fAqk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=j/g0CEmr; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="j/g0CEmr" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jhtPKTCf2rAFUz3lZJnxmPbFv+4BaiLF1W7Jae20gYI=; b=j/g0CEmrxGRCGwQVYvHY/UrX8a XrAAQ9UmOPxMRWI0rhRsrXX0d0Yx5EpPm8YrPkH34Svqe5xREnhckMam2p+ly12QRtE/hj2P03mtW yorPSYlbnkg9sGDE9uPI/af7s7at75lwPgVmv9fwe10NeaFGzw0LNpVa2Qnd9GdyIRv8IoGQpGMrS eIiwZEp98gf05AaM659uXZYcEhw2K9/c0+wO3x8okGCPWuDZ010R2hc1Xh50DLE+SpEfit90FAFVO gKTqREa+2WvZJj3wEwmeNw7qtuGWldAE+/iZ8A7uKgOHS1L6a1EKFzbdeE022S0ggsI0vROkAeM02 MEVPSkcg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34370) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s4P50-00047K-0H; Tue, 07 May 2024 18:58:18 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1s4P4y-0000Vr-JX; Tue, 07 May 2024 18:58:16 +0100 Date: Tue, 7 May 2024 18:58:16 +0100 From: "Russell King (Oracle)" To: =?iso-8859-1?Q?Andr=E9?= Draszik Cc: Marek Szyprowski , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Turquette , Stephen Boyd Subject: Re: [PATCH] clkdev: fix potential NULL pointer dereference Message-ID: References: <20240507064434.3213933-1-m.szyprowski@samsung.com> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) On Tue, May 07, 2024 at 05:42:45PM +0100, André Draszik wrote: > Hi Marek, > > On Tue, 2024-05-07 at 08:44 +0200, Marek Szyprowski wrote: > > diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c > > index ddacab7863d0..d2801ae70e34 100644 > > --- a/drivers/clk/clkdev.c > > +++ b/drivers/clk/clkdev.c > > @@ -194,10 +194,12 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt, > >   return &cla->cl; > >   > >  fail: > > - fmt.fmt = dev_fmt; > > - fmt.va = &ap_copy; > > - pr_err("%pV:%s: %s ID is greater than %zu\n", > > -        &fmt, con_id, failure, max_size); > > + if (dev_fmt) { > > + fmt.fmt = dev_fmt; > > + fmt.va = &ap_copy; > > + pr_err("%pV:%s: %s ID is greater than %zu\n", > > +        &fmt, con_id, failure, max_size); > > + } > > It might be nice to still print the rest of the error, so it's easier to see which > clock is causing trouble. Good point. I'll fix the patch myself, merging the fix in. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! 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 07A53C25B4F for ; Tue, 7 May 2024 17:58:46 +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=glO2LtKT3QglyuY7TVToGama5EERbWExBGoRCAPVxug=; b=SfQNFrMrQXr8F4 OxjKTVDQWzHlAVTqWa5WtRlEGtLg+I7KC5vNmGR+UQIg2EEdmIYPaZAF5tWPvqPlkWNohXF9EScqS TMVV5sfNrbJN3RFpVDc9P4nqxq3eJQ932RXrwLdHy+ooa7qvn7STBBZvKtA48J+L2vDW2WUvGqcxZ 6gOopI0RZazOu6eZEE7ZP18+ZaZ4T58RE0THYVNAayVSqT84U6NIOvsizIa4x5Q0R50l3z94yuJWM r5sowe7XeRziqkObClKtKXJDfotEe3j+3G+IQZOUzwrNuqgJMOnXJYLcA521Br/vaFVcvCiC6cKig xwMvShwiPw5+mVbUbUJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4P5B-0000000CHLs-0M5T; Tue, 07 May 2024 17:58:29 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4P58-0000000CHKv-41UY for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 17:58:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jhtPKTCf2rAFUz3lZJnxmPbFv+4BaiLF1W7Jae20gYI=; b=j/g0CEmrxGRCGwQVYvHY/UrX8a XrAAQ9UmOPxMRWI0rhRsrXX0d0Yx5EpPm8YrPkH34Svqe5xREnhckMam2p+ly12QRtE/hj2P03mtW yorPSYlbnkg9sGDE9uPI/af7s7at75lwPgVmv9fwe10NeaFGzw0LNpVa2Qnd9GdyIRv8IoGQpGMrS eIiwZEp98gf05AaM659uXZYcEhw2K9/c0+wO3x8okGCPWuDZ010R2hc1Xh50DLE+SpEfit90FAFVO gKTqREa+2WvZJj3wEwmeNw7qtuGWldAE+/iZ8A7uKgOHS1L6a1EKFzbdeE022S0ggsI0vROkAeM02 MEVPSkcg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34370) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s4P50-00047K-0H; Tue, 07 May 2024 18:58:18 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1s4P4y-0000Vr-JX; Tue, 07 May 2024 18:58:16 +0100 Date: Tue, 7 May 2024 18:58:16 +0100 From: "Russell King (Oracle)" To: =?iso-8859-1?Q?Andr=E9?= Draszik Cc: Marek Szyprowski , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Turquette , Stephen Boyd Subject: Re: [PATCH] clkdev: fix potential NULL pointer dereference Message-ID: References: <20240507064434.3213933-1-m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_105827_015750_DC6818FA X-CRM114-Status: GOOD ( 14.93 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 07, 2024 at 05:42:45PM +0100, Andr=E9 Draszik wrote: > Hi Marek, > = > On Tue, 2024-05-07 at 08:44 +0200, Marek Szyprowski wrote: > > diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c > > index ddacab7863d0..d2801ae70e34 100644 > > --- a/drivers/clk/clkdev.c > > +++ b/drivers/clk/clkdev.c > > @@ -194,10 +194,12 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_= id, const char *dev_fmt, > > =A0 return &cla->cl; > > =A0 > > =A0fail: > > - fmt.fmt =3D dev_fmt; > > - fmt.va =3D &ap_copy; > > - pr_err("%pV:%s: %s ID is greater than %zu\n", > > - =A0=A0=A0=A0=A0=A0 &fmt, con_id, failure, max_size); > > + if (dev_fmt) { > > + fmt.fmt =3D dev_fmt; > > + fmt.va =3D &ap_copy; > > + pr_err("%pV:%s: %s ID is greater than %zu\n", > > + =A0=A0=A0=A0=A0=A0 &fmt, con_id, failure, max_size); > > + } > = > It might be nice to still print the rest of the error, so it's easier to = see which > clock is causing trouble. Good point. I'll fix the patch myself, merging the fix in. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel