fs does not work?

Assar Westerlund assar at sics.se
Fri Jun 26 09:44:16 CEST 1998


Assar Westerlund <assar at sics.se> writes:
> As for solving it, can anybody tell me copy_{from,to}_user are
> supposed to return?

It seems to me that these functions should return the number of bytes
not copied.

Can people running 2.0 and 2.1 try out the following patches?

/assar


Index: xfs/linux/xfs_common.h
===================================================================
RCS file: /usr/local/cvsroot/arla/xfs/linux/xfs_common.h,v
retrieving revision 1.8
diff -u -w -u -w -r1.8 xfs_common.h
--- xfs_common.h	1998/05/23 20:03:25	1.8
+++ xfs_common.h	1998/06/26 07:39:43
@@ -54,23 +54,19 @@
 static inline unsigned long
 copy_to_user(void *dst, const void *src, unsigned long len)
 {
-    int error;
-
-    if ((error = verify_area(VERIFY_WRITE, dst, len)) != 0)
-	return error;
-    memcpy_tofs(dst, src, len);
+    if (verify_area(VERIFY_WRITE, dst, len) != 0)
     return len;
+    memcpy_tofs(dst, src, len);
+    return 0;
 }
 
 static inline unsigned long
 copy_from_user(void *dst, const void *src, unsigned long len)
 {
-    int error;
-
-    if ((error = verify_area(VERIFY_READ, src, len)) != 0)
-	return error;
-    memcpy_fromfs(dst, src, len);
+    if (verify_area(VERIFY_READ, src, len) != 0)
     return len;
+    memcpy_fromfs(dst, src, len);
+    return 0;
 }
 #endif
 
Index: xfs/linux/xfs_syscalls.c
===================================================================
RCS file: /usr/local/cvsroot/arla/xfs/linux/xfs_syscalls.c,v
retrieving revision 1.16
diff -u -w -u -w -r1.16 xfs_syscalls.c
--- xfs_syscalls.c	1998/06/04 15:51:54	1.16
+++ xfs_syscalls.c	1998/06/26 07:39:56
@@ -258,18 +258,16 @@
     switch (operation) {
     case AFSCALL_PIOCTL:
 	printk("xfs_pioctl\n");
-	error = copy_from_user(&vice_ioctl,a_paramsP,sizeof(*a_paramsP));
-	if (error)
-	    return error;
+	if(copy_from_user(&vice_ioctl,a_paramsP,sizeof(*a_paramsP)) != 0)
+	    return EFAULT;
 	if (vice_ioctl.in_size > 2048) {
 	    printk("xfs_pioctl_call: got a humongous in packet: opcode: %d",
 		   a_opcode);
 	    return EINVAL;
 	}
 	if (vice_ioctl.in_size != 0) {
-	    error = copy_from_user(&msg.msg,vice_ioctl.in,vice_ioctl.in_size);
-	    if (error)
-		return error;
+	    if(copy_from_user(&msg.msg,vice_ioctl.in,vice_ioctl.in_size) != 0)
+		return EFAULT;
 	}
 	if (a_pathP != NULL) {
 #ifndef LINUX2_1





More information about the Arla-drinkers mailing list