[PATCH v3 2/3] driver: rng: Fix SMCCC TRNG crash

Matthias Brugger matthias.bgg at kernel.org
Wed Jan 31 18:04:29 CET 2024


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 <xypron.glpk at gmx.de>
> Signed-off-by: Weizhao Ouyang <o451686892 at gmail.com>

Reviewed-by: Matthias Brugger <mbrugger at suse.com>

> ---
> 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


More information about the U-Boot mailing list