[61] in arla-drinkers

home help back first fref pref prev next nref lref last post

Re: fs does not work?

daemon@ATHENA.MIT.EDU (Assar Westerlund)
Fri Jun 26 03:51:44 1998

From arla-drinkers-request@sundance.stacken.kth.se Fri Jun 26 07:51:44 1998
Return-Path: <arla-drinkers-request@sundance.stacken.kth.se>
Delivered-To: arla-drinkers-mtg@bloom-picayune.mit.edu
Received: (qmail 6915 invoked from network); 26 Jun 1998 07:51:43 -0000
Received: from unknown (HELO sundance.stacken.kth.se) (130.237.234.41)
  by bloom-picayune.mit.edu with SMTP; 26 Jun 1998 07:51:43 -0000
Received: from ZORKMID.MIT.EDU (ZORKMID.MIT.EDU [18.70.0.83])
	by sundance.stacken.kth.se (8.8.8/8.8.8) with ESMTP id JAA19218
	for <arla-drinkers@stacken.kth.se>; Fri, 26 Jun 1998 09:44:16 +0200 (MET DST)
Received: (from assar@localhost) by ZORKMID.MIT.EDU (8.8.5/8.7.3) id JAA18875; Fri, 26 Jun 1998 09:45:36 +0200 (MET DST)
To: Derrick J Brashear <shadow@dementia.org>
Cc: arla-drinkers@stacken.kth.se
Subject: Re: fs does not work?
References: <ML-1.3.2.898843295.7349.root@jooky.dementia.org> <5l7m247i0a.fsf@ZORKMID.MIT.EDU>
Mime-Version: 1.0 (generated by tm-edit 7.68)
Content-Type: multipart/mixed;
 boundary="Multipart_Fri_Jun_26_09:45:31_1998-1"
Content-Transfer-Encoding: 7bit
From: Assar Westerlund <assar@sics.se>
Date: 26 Jun 1998 09:45:31 +0200
In-Reply-To: Assar Westerlund's message of "26 Jun 1998 09:13:25 +0200"
Message-ID: <5lu35861yc.fsf@ZORKMID.MIT.EDU>
Lines: 86
X-Mailer: Gnus v5.5/Emacs 19.34

--Multipart_Fri_Jun_26_09:45:31_1998-1
Content-Type: text/plain; charset=US-ASCII

Assar Westerlund <assar@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

--Multipart_Fri_Jun_26_09:45:31_1998-1
Content-Type: text/plain; charset=US-ASCII

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

--Multipart_Fri_Jun_26_09:45:31_1998-1--

home help back first fref pref prev next nref lref last post