lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 8 Apr 2009 09:22:54 -0400
From:	Christoph Hellwig <hch@...radead.org>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	felixb@....com, Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>, xfs@....sgi.com
Subject: Re: [PATCH 4/6] xfs: use memdup_user()

On Wed, Apr 08, 2009 at 03:08:04PM +0800, Li Zefan wrote:
> Remove open-coded memdup_user()
> 
> Signed-off-by: Li Zefan <lizf@...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@....de>
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ