X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fia64%2Fia32%2Fia32_ldt.c;h=a152738c7d0d33a9496b1a4bc89d14ca9ec9c78b;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=4cc8242de8c7d3769377ad4538caa2d50201bee7;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/arch/ia64/ia32/ia32_ldt.c b/arch/ia64/ia32/ia32_ldt.c index 4cc8242de..a152738c7 100644 --- a/arch/ia64/ia32/ia32_ldt.c +++ b/arch/ia64/ia32/ia32_ldt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Hewlett-Packard Co + * Copyright (C) 2001, 2004 Hewlett-Packard Co * David Mosberger-Tang * * Adapted from arch/i386/kernel/ldt.c @@ -17,25 +17,24 @@ #include "ia32priv.h" -#define P(p) ((void *) (unsigned long) (p)) - /* * read_ldt() is not really atomic - this is not a problem since synchronization of reads * and writes done to the LDT has to be assured by user-space anyway. Writes are atomic, * to protect the security checks done on new descriptors. */ static int -read_ldt (void *ptr, unsigned long bytecount) +read_ldt (void __user *ptr, unsigned long bytecount) { - char *src, *dst, buf[256]; /* temporary buffer (don't overflow kernel stack!) */ unsigned long bytes_left, n; + char __user *src, *dst; + char buf[256]; /* temporary buffer (don't overflow kernel stack!) */ if (bytecount > IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE) bytecount = IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE; bytes_left = bytecount; - src = (void *) IA32_LDT_OFFSET; + src = (void __user *) IA32_LDT_OFFSET; dst = ptr; while (bytes_left) { @@ -61,7 +60,7 @@ read_ldt (void *ptr, unsigned long bytecount) } static int -read_default_ldt (void * ptr, unsigned long bytecount) +read_default_ldt (void __user * ptr, unsigned long bytecount) { unsigned long size; int err; @@ -80,7 +79,7 @@ read_default_ldt (void * ptr, unsigned long bytecount) } static int -write_ldt (void * ptr, unsigned long bytecount, int oldmode) +write_ldt (void __user * ptr, unsigned long bytecount, int oldmode) { struct ia32_user_desc ldt_info; __u64 entry; @@ -120,7 +119,7 @@ write_ldt (void * ptr, unsigned long bytecount, int oldmode) * memory, but we still need to guard against out-of-memory, hence we must use * put_user(). */ - ret = __put_user(entry, (__u64 *) IA32_LDT_OFFSET + ldt_info.entry_number); + ret = __put_user(entry, (__u64 __user *) IA32_LDT_OFFSET + ldt_info.entry_number); ia32_load_segment_descriptors(current); return ret; } @@ -132,16 +131,16 @@ sys32_modify_ldt (int func, unsigned int ptr, unsigned int bytecount) switch (func) { case 0: - ret = read_ldt(P(ptr), bytecount); + ret = read_ldt(compat_ptr(ptr), bytecount); break; case 1: - ret = write_ldt(P(ptr), bytecount, 1); + ret = write_ldt(compat_ptr(ptr), bytecount, 1); break; case 2: - ret = read_default_ldt(P(ptr), bytecount); + ret = read_default_ldt(compat_ptr(ptr), bytecount); break; case 0x11: - ret = write_ldt(P(ptr), bytecount, 0); + ret = write_ldt(compat_ptr(ptr), bytecount, 0); break; } return ret;