lkml.org 
[lkml]   [2009]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [patch 6/8] cifs: use kzfree()
From
Looks fine to me:

Acked-by: Steve French <sfrench@us.ibm.com>

On Mon, Feb 16, 2009 at 9:33 AM, Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> 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);
> }
>



--
Thanks,

Steve


\
 
 \ /
  Last update: 2009-02-18 12:23    [from the cache]
©2003-2011 Jasper Spaans