[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84144f020807190430r680b2fc4kf8be4d3ebc3c019c@mail.gmail.com>
Date: Sat, 19 Jul 2008 14:30:11 +0300
From: "Pekka Enberg" <penberg@...helsinki.fi>
To: "Li Zefan" <lizf@...fujitsu.com>
Cc: "Andrew Morton" <akpm@...ux-foundation.org>,
"Al Viro" <viro@...iv.linux.org.uk>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfs: use kstrdup()
On Sat, Jul 19, 2008 at 1:16 PM, Li Zefan <lizf@...fujitsu.com> wrote:
> This piece of code can be replaced by a kstrdup().
>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
Looks good to me.
Reviewed-by: Pekka Enberg <penberg@...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@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists