linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Steve French <sfrench@samba.org>
Subject: Re: [patch 6/8] cifs: use kzfree()
Date: Mon, 16 Feb 2009 16:33:51 +0100	[thread overview]
Message-ID: <20090216153351.GB27520@cmpxchg.org> (raw)
In-Reply-To: <84144f020902160713y7341b2b4g8aa10919405ab82d@mail.gmail.com>

On Mon, Feb 16, 2009 at 05:13:30PM +0200, Pekka Enberg wrote:
> Hi Johannes,
> 
> On Mon, Feb 16, 2009 at 4:29 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> > @@ -2433,11 +2433,8 @@ mount_fail_check:
> >  out:
> >        /* zero out password before freeing */
> >        if (volume_info) {
> > -               if (volume_info->password != NULL) {
> > -                       memset(volume_info->password, 0,
> > -                               strlen(volume_info->password));
> > -                       kfree(volume_info->password);
> > -               }
> > +               if (volume_info->password != NULL)
> > +                       kzfree(volume_info->password);
> 
> The NULL check here is unnecessary.
> 
> >                kfree(volume_info->UNC);
> >                kfree(volume_info->prepath);
> >                kfree(volume_info);
> > --- a/fs/cifs/misc.c
> > +++ b/fs/cifs/misc.c
> > @@ -97,10 +97,8 @@ sesInfoFree(struct cifsSesInfo *buf_to_f
> >        kfree(buf_to_free->serverOS);
> >        kfree(buf_to_free->serverDomain);
> >        kfree(buf_to_free->serverNOS);
> > -       if (buf_to_free->password) {
> > -               memset(buf_to_free->password, 0, strlen(buf_to_free->password));
> > -               kfree(buf_to_free->password);
> > -       }
> > +       if (buf_to_free->password)
> > +               kzfree(buf_to_free->password);
> 
> And here.

Thanks, Pekka!

Here is the delta to fold into the above:

[ btw, do these require an extra SOB?  If so:
  Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

  And for http://lkml.org/lkml/2009/2/16/184:
  Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> ]

--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2433,8 +2433,7 @@ mount_fail_check:
 out:
 	/* zero out password before freeing */
 	if (volume_info) {
-		if (volume_info->password != NULL)
-			kzfree(volume_info->password);
+		kzfree(volume_info->password);
 		kfree(volume_info->UNC);
 		kfree(volume_info->prepath);
 		kfree(volume_info);
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -97,8 +97,7 @@ sesInfoFree(struct cifsSesInfo *buf_to_f
 	kfree(buf_to_free->serverOS);
 	kfree(buf_to_free->serverDomain);
 	kfree(buf_to_free->serverNOS);
-	if (buf_to_free->password)
-		kzfree(buf_to_free->password);
+	kzfree(buf_to_free->password);
 	kfree(buf_to_free->domainName);
 	kfree(buf_to_free);
 }
@@ -130,8 +129,7 @@ tconInfoFree(struct cifsTconInfo *buf_to
 	}
 	atomic_dec(&tconInfoAllocCount);
 	kfree(buf_to_free->nativeFileSystem);
-	if (buf_to_free->password)
-		kzfree(buf_to_free->password);
+	kzfree(buf_to_free->password);
 	kfree(buf_to_free);
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-02-16 15:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16 14:29 [patch 0/8] kzfree() Johannes Weiner
2009-02-16 14:29 ` [patch 1/8] slab: introduce kzfree() Johannes Weiner
2009-02-16 15:27   ` Johannes Weiner
2009-02-17 15:08     ` Christoph Lameter
2009-02-17 15:51       ` Pekka Enberg
2009-02-17 16:01         ` Christoph Lameter
2009-02-16 14:29 ` [patch 2/8] crypto: use kzfree() Johannes Weiner
2009-02-16 14:29 ` [patch 3/8] s390: " Johannes Weiner
2009-02-16 14:29 ` [patch 4/8] md: " Johannes Weiner
2009-02-16 14:29 ` [patch 5/8] usb: " Johannes Weiner
2009-02-16 14:29 ` [patch 6/8] cifs: " Johannes Weiner
2009-02-16 15:13   ` Pekka Enberg
2009-02-16 15:33     ` Johannes Weiner [this message]
2009-02-16 18:17       ` Pekka Enberg
2009-02-16 19:01       ` Steve French
2009-02-16 19:02       ` Steve French
2009-02-16 14:29 ` [patch 7/8] ecryptfs: " Johannes Weiner
2009-02-16 20:02   ` Andrew Morton
2009-02-16 20:28     ` Johannes Weiner
2009-02-17  7:51   ` Tyler Hicks
2009-02-16 14:29 ` [patch 8/8] atm: " Johannes Weiner
2009-02-16 19:59 ` [patch 0/8] kzfree() Andrew Morton
2009-02-16 19:58   ` Pekka Enberg
2009-02-16 20:19     ` Andrew Morton

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=20090216153351.GB27520@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=sfrench@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox