[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[microblaze-uclinux] Patch for kernel 2.6: /dev/zero reading is buggy
Hello,
if you try to read /dev/zero on a microblaze system with kernel 2.6 the
behaviour was unpredictable. The reason for this was that the function
"clear_user" was a simple dummy. Here is a patch which corrects this
problem. It is based on the "petalinux-v0.20-rc3" release version.
Hans
--
Dr. Johann Pfefferl ------------ mailto j.pfefferl at eubus dot net
Eubus GmbH http://www.eubus.net +++++ http://www.hydraxc.com
Gollierstr. 70
D-80339 Muenchen
Phone: +49 (0)89 45 22 578-67 Fax: +49 (0)89 45 22 578-55
Registergericht Muenchen HRB 145 336, Ust-Id Nr. DE 225 783 933
Geschaeftsfuehrer: Volker Ulrich, Peter Sibities
==
-o) A computer program does what you tell it to do,
/\\ not what you want it to do.
_\_v-
Reading from /dev/zero has not worked because function clear_user
was buggy
---
commit 08c2c5b1af3b78ca49ba9848919b8d91d0a1b4d4
tree 7aea1c949785df986f2bba31cdf92f0d987f5db9
parent 7d48f2457c785f33e924e248ec5495ff9b9d2e88
author Dr. Johann Pfefferl <pfefferl@xxxxxxx> Tue, 30 Oct 2007 10:38:07 +0100
committer Dr. Johann Pfefferl <pfefferl@xxxxxxxxxxxxxxx> Tue, 30 Oct 2007 10:38:07 +0100
.../include/asm-microblaze/uaccess.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/software/linux-2.6.x-petalogix/include/asm-microblaze/uaccess.h b/software/linux-2.6.x-petalogix/include/asm-microblaze/uaccess.h
index 052f384..2f577fa 100644
--- a/software/linux-2.6.x-petalogix/include/asm-microblaze/uaccess.h
+++ b/software/linux-2.6.x-petalogix/include/asm-microblaze/uaccess.h
@@ -94,6 +94,7 @@ extern inline int bad_user_access_length (void)
#define __copy_to_user_inatomic(to,from,n) (__copy_to_user(to,from,n))
#define __copy_from_user_inatomic(to,from,n) (__copy_from_user(to,from,n))
+#define __clear_user(addr,n) (memset((void *)addr, 0, n), 0)
/*
* The exception table consists of pairs of addresses: the first is the
@@ -114,6 +115,9 @@ struct exception_table_entry
static inline unsigned long clear_user(void *addr, unsigned long size)
{
+ if (access_ok(VERIFY_WRITE, addr, size))
+ size = __clear_user(addr, size);
+ return size;
}
/* Returns 0 if exception not found and fixup otherwise. */