public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Provide example copy_in_user implementation
@ 2003-06-24 10:06 Pavel Machek
  2003-06-24 10:18 ` Russell King
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pavel Machek @ 2003-06-24 10:06 UTC (permalink / raw)
  To: torvalds, kernel list, Rusty trivial patch monkey Russell

Hi!

This patch adds example copy_in_user implementation (copy_in_user is
needed for new ioctl32 implementation, all 64bit archs will need
it)... Please apply,

								Pavel

Index: linux/include/asm-generic/uaccess.h
===================================================================
--- linux.orig/include/asm-generic/uaccess.h	2003-06-17 17:10:44.000000000 +0200
+++ linux/include/asm-generic/uaccess.h	2003-06-16 16:09:52.000000000 +0200
@@ -0,0 +1,13 @@
+static inline unsigned long copy_in_user(void *dst, const void *src, unsigned size) 
+{ 
+	unsigned i, ret;
+	unsigned char c;
+	for (i=0; i<size; i++) {
+		if (copy_from_user(&c, src+i, 1)) 
+			return size-i;
+		if (copy_to_user(dst+i, &c, 1))
+			return size-i;
+	}
+	return 0;
+}	
+


-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-06-24 18:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-24 10:06 Provide example copy_in_user implementation Pavel Machek
2003-06-24 10:18 ` Russell King
2003-06-24 10:25   ` Pavel Machek
2003-06-24 11:01     ` Russell King
2003-06-24 18:52     ` Linus Torvalds
2003-06-24 10:29 ` Andrew Morton
2003-06-24 10:33   ` Pavel Machek
2003-06-24 18:51 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox