mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "Li Zefan" <lizf@cn.fujitsu.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Al Viro" <viro@zeniv.linux.org.uk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vfs: use kstrdup()
Date: Sat, 19 Jul 2008 14:30:11 +0300	[thread overview]
Message-ID: <84144f020807190430r680b2fc4kf8be4d3ebc3c019c@mail.gmail.com> (raw)
In-Reply-To: <4881BEF4.2020201@cn.fujitsu.com>

On Sat, Jul 19, 2008 at 1:16 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
> This piece of code can be replaced by a kstrdup().
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

Looks good to me.

Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>

> ---
>  fs/namespace.c |    9 +--------
>  1 files changed, 1 insertions(+), 8 deletions(-)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 4f6f763..08c3b2d 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -127,14 +127,7 @@ struct vfsmount *alloc_vfsmnt(const char *name)
>                INIT_LIST_HEAD(&mnt->mnt_slave_list);
>                INIT_LIST_HEAD(&mnt->mnt_slave);
>                atomic_set(&mnt->__mnt_writers, 0);
> -               if (name) {
> -                       int size = strlen(name) + 1;
> -                       char *newname = kmalloc(size, GFP_KERNEL);
> -                       if (newname) {
> -                               memcpy(newname, name, size);
> -                               mnt->mnt_devname = newname;
> -                       }
> -               }
> +               mnt->mnt_devname = kstrdup(name, GFP_KERNEL);
>        }
>        return mnt;
>  }
> --
> 1.5.4.rc3
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

  reply	other threads:[~2008-07-19 11:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-19 10:16 Li Zefan
2008-07-19 11:30 ` Pekka Enberg [this message]
2008-07-19 13:13 ` Cyrill Gorcunov
2008-07-19 13:19   ` Cyrill Gorcunov
2008-07-21  5:27     ` Al Viro
2008-07-21  6:29       ` Li Zefan
2008-07-21  7:03         ` Al Viro
2008-07-21  7:09           ` Cyrill Gorcunov
2008-07-21  8:04           ` Cyrill Gorcunov
2008-07-21  8:28             ` Li Zefan
2008-07-21  8:44               ` Cyrill Gorcunov
2008-07-21  8:59                 ` Li Zefan
2008-07-21  9:06                   ` Pekka Enberg
2008-07-21 10:05                     ` Cyrill Gorcunov
2008-07-21 10:10                       ` Li Zefan
2008-07-21 10:17                         ` Cyrill Gorcunov
2008-07-21  9:12                   ` Al Viro
2008-07-21  8:28             ` Al Viro
2008-07-21  8:35               ` Cyrill Gorcunov
2008-07-21  8:42               ` Cyrill Gorcunov

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=84144f020807190430r680b2fc4kf8be4d3ebc3c019c@mail.gmail.com \
    --to=penberg@cs.helsinki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®