lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ywc3u9ObRCpxQsK0@gondor.apana.org.au>
Date:   Thu, 25 Aug 2022 16:50:03 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Gaosheng Cui <cuigaosheng1@...wei.com>
Cc:     davem@...emloft.net, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next 1/2] crypto: api - Fix IS_ERR() vs NULL check

On Thu, Aug 25, 2022 at 04:41:37PM +0800, Gaosheng Cui wrote:
> The crypto_alloc_test_larval() will return null if manager is disabled,
> it may not return error pointers, so using IS_ERR_OR_NULL()
> to check the return value to fix this.
> 
> The __crypto_register_alg() will return null if manager is disabled,
> it may not return error pointers, so using IS_ERR_OR_NULL()
> to check the return value to fix this.
> 
> Fixes: cad439fc040e ("crypto: api - Do not create test larvals if manager is disabled")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@...wei.com>
> ---
>  crypto/algapi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/crypto/algapi.c b/crypto/algapi.c
> index 5c69ff8e8fa5..5a080b8aaa11 100644
> --- a/crypto/algapi.c
> +++ b/crypto/algapi.c
> @@ -283,7 +283,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg)
>  	}
>  
>  	larval = crypto_alloc_test_larval(alg);
> -	if (IS_ERR(larval))
> +	if (IS_ERR_OR_NULL(larval))
>  		goto out;

A NULL indicates success, why are you jumping to the error path?

Cheers,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ