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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B71B0C47258 for ; Wed, 31 Jan 2024 17:04:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A1988799C; Wed, 31 Jan 2024 18:04:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="JdmIT8+d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C8AF087B75; Wed, 31 Jan 2024 18:04:38 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CF08C8785E for ; Wed, 31 Jan 2024 18:04:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matthias.bgg@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5148461775; Wed, 31 Jan 2024 17:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EA6CC433C7; Wed, 31 Jan 2024 17:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706720675; bh=oPtkbDNNmEmspr75L2euCefrDZ9J1VxPFONCS0vZvnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JdmIT8+dyP+eJFX4jCyPAMbgPMxVBmkrwh4Px4KRL1ILC+vEN43GCzhJpSbGru2Rg 2DECdwK9j0V8KtC0dh9tqIyyYpnFqHjAQxvJDrp91k7o+l7KOfdCSB13L/6l65CiVI mux95M86g27suqq54wr+uVyCTMubCm0//fnr3XWeDOTjM85PpjQr17jEvLpsugSSSC WVH27GlVGGZbrJX2w34pxghqt37FJDKrg8UcBYU05zepEfcdhjS3MiQ6ktV4f3ihKa EW5/VDVJ9TVVl0/AraGJOzlRn22o+KorBHTjObNYcesBuUP5vYnTaUOnphj/TrrwHv arLwbxNAxEqeg== Date: Wed, 31 Jan 2024 18:04:29 +0100 From: Matthias Brugger To: Weizhao Ouyang Cc: Sughosh Ganu , Heinrich Schuchardt , Tom Rini , Etienne Carriere , Simon Glass , Peng Fan , Ilias Apalodimas , Jens Wiklander , Abdellatif El Khlifi , u-boot@lists.denx.de Subject: Re: [PATCH v3 2/3] driver: rng: Fix SMCCC TRNG crash Message-ID: References: <20240131141426.34926-1-o451686892@gmail.com> <20240131141426.34926-3-o451686892@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240131141426.34926-3-o451686892@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Wed, Jan 31, 2024 at 02:14:25PM +0000, Weizhao Ouyang wrote: > Fix a SMCCC TRNG null pointer crash due to a failed smccc feature > binding. > > Fixes: 53355bb86c25 ("drivers: rng: add smccc trng driver") > Reviewed-by: Heinrich Schuchardt > Signed-off-by: Weizhao Ouyang Reviewed-by: Matthias Brugger > --- > v3: add Fixes tag > --- > drivers/rng/smccc_trng.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/rng/smccc_trng.c b/drivers/rng/smccc_trng.c > index 3a4bb33941..3087cb991a 100644 > --- a/drivers/rng/smccc_trng.c > +++ b/drivers/rng/smccc_trng.c > @@ -166,7 +166,7 @@ static int smccc_trng_probe(struct udevice *dev) > struct smccc_trng_priv *priv = dev_get_priv(dev); > struct arm_smccc_res res; > > - if (!(smccc_trng_is_supported(smccc->invoke_fn))) > + if (!smccc || !(smccc_trng_is_supported(smccc->invoke_fn))) > return -ENODEV; > > /* At least one of 64bit and 32bit interfaces is available */ > -- > 2.39.2