All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: James Morris <jmorris@intercode.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Resend: [PATCH] crypto: don't check for NULL before kfree(), it's redundant.
Date: Tue, 7 Jun 2005 01:50:06 +0200	[thread overview]
Message-ID: <9a8748490506061650477c8b7@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]

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.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
--- 

 crypto/cipher.c |    3 +--
 crypto/hmac.c   |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff -upr linux-2.6.12-rc6-orig/crypto/cipher.c linux-2.6.12-rc6/crypto/cipher.c
--- linux-2.6.12-rc6-orig/crypto/cipher.c	2005-06-07 00:07:12.000000000 +0200
+++ linux-2.6.12-rc6/crypto/cipher.c	2005-06-07 01:49:16.000000000 +0200
@@ -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);
 }
diff -upr linux-2.6.12-rc6-orig/crypto/hmac.c linux-2.6.12-rc6/crypto/hmac.c
--- linux-2.6.12-rc6-orig/crypto/hmac.c	2005-03-02 08:38:09.000000000 +0100
+++ linux-2.6.12-rc6/crypto/hmac.c	2005-06-07 01:49:16.000000000 +0200
@@ -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)



-- 
Jesper Juhl <jesper.juhl@gmail.com>
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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: crypto-kfree.patch --]
[-- Type: text/x-patch; name="crypto-kfree.patch", Size: 961 bytes --]

diff -upr linux-2.6.12-rc6-orig/crypto/cipher.c linux-2.6.12-rc6/crypto/cipher.c
--- linux-2.6.12-rc6-orig/crypto/cipher.c	2005-06-07 00:07:12.000000000 +0200
+++ linux-2.6.12-rc6/crypto/cipher.c	2005-06-07 01:49:16.000000000 +0200
@@ -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);
 }
diff -upr linux-2.6.12-rc6-orig/crypto/hmac.c linux-2.6.12-rc6/crypto/hmac.c
--- linux-2.6.12-rc6-orig/crypto/hmac.c	2005-03-02 08:38:09.000000000 +0100
+++ linux-2.6.12-rc6/crypto/hmac.c	2005-06-07 01:49:16.000000000 +0200
@@ -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)

             reply	other threads:[~2005-06-06 23:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 23:50 Jesper Juhl [this message]
2005-06-07  2:34 ` Resend: [PATCH] crypto: don't check for NULL before kfree(), it's redundant Herbert Xu
2005-06-07 13:13   ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a8748490506061650477c8b7@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --cc=jmorris@intercode.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.