From: Christoph Hellwig <hch@infradead.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
xfs@oss.sgi.com
Subject: Re: [PATCH 4/6] xfs: use memdup_user()
Date: Wed, 8 Apr 2009 09:22:54 -0400 [thread overview]
Message-ID: <20090408132254.GA5957@infradead.org> (raw)
In-Reply-To: <49DC4D54.3020001@cn.fujitsu.com>
On Wed, Apr 08, 2009 at 03:08:04PM +0800, Li Zefan wrote:
> Remove open-coded memdup_user()
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> fs/xfs/linux-2.6/xfs_ioctl.c | 23 +++++++----------------
> fs/xfs/linux-2.6/xfs_ioctl32.c | 12 ++++--------
> 2 files changed, 11 insertions(+), 24 deletions(-)
>
> diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
> index d0b4994..34eaab6 100644
> --- a/fs/xfs/linux-2.6/xfs_ioctl.c
> +++ b/fs/xfs/linux-2.6/xfs_ioctl.c
> @@ -489,17 +489,12 @@ xfs_attrmulti_attr_set(
> if (len > XATTR_SIZE_MAX)
> return EINVAL;
>
> - kbuf = kmalloc(len, GFP_KERNEL);
> - if (!kbuf)
> - return ENOMEM;
> -
> - if (copy_from_user(kbuf, ubuf, len))
> - goto out_kfree;
> + kbuf = memdup_user(ubuf, len);
> + if (IS_ERR(kbuf))
> + return PTR_ERR(kbuf);
wouldn't NULL be a better error return for this kind of interface,
matching kmalloc?
Otherwise the patch looks good to me.
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-04-08 13:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <49DC4CC0.9050805@cn.fujitsu.com>
2009-04-08 7:08 ` [PATCH 4/6] xfs: use memdup_user() Li Zefan
2009-04-08 13:22 ` Christoph Hellwig [this message]
2009-04-08 17:31 ` Roland Dreier
2009-04-09 0:43 ` Li Zefan
2009-04-08 20:06 ` Felix Blyakher
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=20090408132254.GA5957@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=xfs@oss.sgi.com \
/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