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: <E1JqqUc-0005Rg-00@gondolin.me.apana.org.au>
Date:	Tue, 29 Apr 2008 22:07:38 +0800
From:	Herbert Xu <herbert@...dor.apana.org.au>
To:	julia@...u.dk (Julia Lawall)
Cc:	herbert@...dor.apana.org.au, davem@...emloft.net,
	linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] crypto: Correct kzalloc error test

Julia Lawall <julia@...u.dk> wrote:
> From: Julia Lawall <julia@...u.dk>
> 
> Normally, kzalloc returns NULL or a valid pointer value, not a value to be
> tested using IS_ERR.

Ouch :)

> diff -u -p  a/crypto/cryptd.c b/crypto/cryptd.c
> --- a/crypto/cryptd.c   2008-04-16 13:27:56.000000000 +0200
> +++ b/crypto/cryptd.c   2008-04-29 15:29:54.000000000 +0200
> @@ -190,7 +190,7 @@ static struct crypto_instance *cryptd_al
>        int err;
> 
>        inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
> -       if (IS_ERR(inst))
> +       if (!inst)
>                goto out;

However, this function is expected to return an ERR_PTR so you'll
need set it to ENOMEM first.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ