
From: Nathan Scott <nathans@sgi.com>,
      Andreas Gruenbacher <agruen@suse.de>

XFS regression tests tripped a couple of problems with the recent xattr fix.



---

 fs/xattr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN fs/xattr.c~xattr-error-checking-fix fs/xattr.c
--- 25/fs/xattr.c~xattr-error-checking-fix	2004-02-08 19:37:27.000000000 -0800
+++ 25-akpm/fs/xattr.c	2004-02-08 19:37:27.000000000 -0800
@@ -140,7 +140,7 @@ getxattr(struct dentry *d, char __user *
 			goto out;
 		error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
 		if (error > 0) {
-			if (copy_to_user(value, kvalue, error))
+			if (size && copy_to_user(value, kvalue, error))
 				error = -EFAULT;
 		} else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {
 			/* The file system tried to returned a value bigger
@@ -222,7 +222,7 @@ listxattr(struct dentry *d, char __user 
 			goto out;
 		error = d->d_inode->i_op->listxattr(d, klist, size);
 		if (error > 0) {
-			if (copy_to_user(list, klist, error))
+			if (size && copy_to_user(list, klist, error))
 				error = -EFAULT;
 		} else if (error == -ERANGE && size >= XATTR_LIST_MAX) {
 			/* The file system tried to returned a list bigger

_
