Messages in this thread | | | Date | Mon, 21 Sep 1998 23:55:20 -0400 | From | "Theodore Y. Ts'o" <> | Subject | Re: NT DDK vs. Linux DDI, a practical comparison [long] |
| |
From: Andi Kleen <ak@muc.de> Date: 20 Sep 1998 09:26:49 +0200
#if LINUX_VERSION_CODE < 0x020100 static inline int copy_to_user(void *dst, void *src, int len) { int err; err = verify_area(VERIFY_WRITE,dst,len); if (!err) memcpy_tofs(dst,src,len); return 0; }
static inline int copy_from_user(void *dst, void *src, int len) { int err; err = verify_area(VERIFY_READ,src,len); if (!err) memcpy_fromfs(dst,src,len); return 0; } #else # include <asm/uaccess.h> #endif
and check the return value from copy_from/to_user in the higher level functions.
Err... I don't think this is right, because these functions don't return the proper error return if verify_area fails. I think they should rather be:
#if (LINUX_VERSION_CODE < 131336) int copy_from_user(void *to, const void *from_user, unsigned long len) { int error; error = verify_area(VERIFY_READ, from_user, len); if (error) return len; memcpy_fromfs(to, from_user, len); return 0; } int copy_to_user(void *to_user, const void *from, unsigned long len) { int error; error = verify_area(VERIFY_WRITE, to_user, len); if (error) return len; memcpy_tofs(to_user, from, len); return 0; } #endif
- Ted
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |