Skip to contentSkip to conversation

Resend: [PATCH] crypto: don't check for NULL before kfree(), it's redundant.

PATCH Jesper Juhl 2 participants 3 messages Jun 6, 2005 – Jun 7, 2005 Crypto API

lore
Share & tools
lore
#0 lore raw

Here's a resend of a patch originally for 2.6.12-rc1-mm4. It still applies to 2.6.12-rc6

The patch removes redundant checks of NULL before kfree() in crypto/ .

Patch attached as well as inline since I don't know how well gmail handles inline patches.

---

 crypto/cipher.c |    3 +--
 crypto/hmac.c   |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
crypto/cipher.c +1 -2
diff -upr linux-2.6.12-rc6-orig/crypto/cipher.c linux-2.6.12-rc6/crypto/cipher.c
@@ -336,6 +336,5 @@ out:	
 
 void crypto_exit_cipher_ops(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_cipher.cit_iv)
-		kfree(tfm->crt_cipher.cit_iv);
+	kfree(tfm->crt_cipher.cit_iv);
 }
crypto/hmac.c +1 -2
diff -upr linux-2.6.12-rc6-orig/crypto/hmac.c linux-2.6.12-rc6/crypto/hmac.c
@@ -49,8 +49,7 @@ int crypto_alloc_hmac_block(struct crypt
 
 void crypto_free_hmac_block(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_digest.dit_hmac_block)
-		kfree(tfm->crt_digest.dit_hmac_block);
+	kfree(tfm->crt_digest.dit_hmac_block);
 }
 
 void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen)
Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
crypto/cipher.c +1 -2
diff -upr linux-2.6.12-rc6-orig/crypto/cipher.c linux-2.6.12-rc6/crypto/cipher.c
@@ -336,6 +336,5 @@ out:	
 
 void crypto_exit_cipher_ops(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_cipher.cit_iv)
-		kfree(tfm->crt_cipher.cit_iv);
+	kfree(tfm->crt_cipher.cit_iv);
 }
crypto/hmac.c +1 -2
diff -upr linux-2.6.12-rc6-orig/crypto/hmac.c linux-2.6.12-rc6/crypto/hmac.c
@@ -49,8 +49,7 @@ int crypto_alloc_hmac_block(struct crypt
 
 void crypto_free_hmac_block(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_digest.dit_hmac_block)
-		kfree(tfm->crt_digest.dit_hmac_block);
+	kfree(tfm->crt_digest.dit_hmac_block);
 }
 
 void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen)
maintainer
#1 lore raw
Quoted 8 lines · Jesper Juhl

Here's a resend of a patch originally for 2.6.12-rc1-mm4. It still applies to 2.6.12-rc6

The patch removes redundant checks of NULL before kfree() in crypto/ .

Patch attached as well as inline since I don't know how well gmail handles inline patches.

I've already merged your patch. It will be pushed upstream after 2.6.12 is released.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 5 lines · Herbert Xu
Quoted 4 lines · Jesper Juhl

Here's a resend of a patch originally for 2.6.12-rc1-mm4. It still applies to 2.6.12-rc6

Quoted 7 lines
Quoted 4 lines

The patch removes redundant checks of NULL before kfree() in crypto/ .

Patch attached as well as inline since I don't know how well gmail handles inline patches.

I've already merged your patch. It will be pushed upstream after 2.6.12 is released.

Ohh, ok. Thanks. I need to keep better track of what patches people have already merged.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html