aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-02-08 11:06:09 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-08 11:06:09 -0500
commit423ab71a8bd2345f87724abe320092a3a516b0bb (patch)
tree5d5eb306001e4341c3c073777f4d0b9e05ccd454
parentb7ed1de0ae4edb3fd2c53fa3dd7e6f104beb6d00 (diff)
parent63f716b9419420defb3e550a1e5f526c11b2ed2d (diff)
Merge branch 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/bird
-rw-r--r--arch/arm/Kconfig5
-rw-r--r--arch/powerpc/kernel/signal_32.c18
-rw-r--r--arch/powerpc/kernel/signal_64.c4
-rw-r--r--arch/powerpc/platforms/powermac/pci.c89
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/s390/kernel/compat_linux.c83
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--arch/s390/kernel/traps.c2
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/io.c30
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/isdn/hisax/Kconfig2
-rw-r--r--drivers/media/video/compat_ioctl32.c89
-rw-r--r--drivers/mtd/chips/Kconfig2
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c2
-rw-r--r--drivers/serial/m32r_sio.h2
-rw-r--r--drivers/sn/ioc3.c18
-rw-r--r--fs/compat_ioctl.c8
-rw-r--r--include/asm-mips/io.h32
-rw-r--r--include/asm-powerpc/compat.h5
-rw-r--r--include/asm-powerpc/thread_info.h2
-rw-r--r--include/asm-s390/uaccess.h10
-rw-r--r--include/linux/ioc3.h2
-rw-r--r--include/linux/videodev2.h2
23 files changed, 209 insertions, 206 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5959e36c3b4c..4a63a8e2e452 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -69,6 +69,9 @@ config GENERIC_ISA_DMA
69config FIQ 69config FIQ
70 bool 70 bool
71 71
72config ARCH_MTD_XIP
73 bool
74
72source "init/Kconfig" 75source "init/Kconfig"
73 76
74menu "System Type" 77menu "System Type"
@@ -136,6 +139,7 @@ config ARCH_L7200
136 139
137config ARCH_PXA 140config ARCH_PXA
138 bool "PXA2xx-based" 141 bool "PXA2xx-based"
142 select ARCH_MTD_XIP
139 143
140config ARCH_RPC 144config ARCH_RPC
141 bool "RiscPC" 145 bool "RiscPC"
@@ -152,6 +156,7 @@ config ARCH_SA1100
152 bool "SA1100-based" 156 bool "SA1100-based"
153 select ISA 157 select ISA
154 select ARCH_DISCONTIGMEM_ENABLE 158 select ARCH_DISCONTIGMEM_ENABLE
159 select ARCH_MTD_XIP
155 160
156config ARCH_S3C2410 161config ARCH_S3C2410
157 bool "Samsung S3C2410" 162 bool "Samsung S3C2410"
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index c6d0595da6b5..bd837b5dbf06 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -142,11 +142,7 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
142 return 0; 142 return 0;
143} 143}
144 144
145static inline compat_uptr_t to_user_ptr(void *kp) 145#define to_user_ptr(p) ptr_to_compat(p)
146{
147 return (compat_uptr_t)(u64)kp;
148}
149
150#define from_user_ptr(p) compat_ptr(p) 146#define from_user_ptr(p) compat_ptr(p)
151 147
152static inline int save_general_regs(struct pt_regs *regs, 148static inline int save_general_regs(struct pt_regs *regs,
@@ -213,8 +209,8 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
213 return 0; 209 return 0;
214} 210}
215 211
216#define to_user_ptr(p) (p) 212#define to_user_ptr(p) ((unsigned long)(p))
217#define from_user_ptr(p) (p) 213#define from_user_ptr(p) ((void __user *)(p))
218 214
219static inline int save_general_regs(struct pt_regs *regs, 215static inline int save_general_regs(struct pt_regs *regs,
220 struct mcontext __user *frame) 216 struct mcontext __user *frame)
@@ -526,7 +522,7 @@ long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
526 522
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 523 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
528 if (!ret && oact) { 524 if (!ret && oact) {
529 ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler); 525 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask); 526 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 527 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
532 } 528 }
@@ -675,8 +671,8 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
675int compat_sys_sigaltstack(u32 __new, u32 __old, int r5, 671int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
676 int r6, int r7, int r8, struct pt_regs *regs) 672 int r6, int r7, int r8, struct pt_regs *regs)
677{ 673{
678 stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; 674 stack_32_t __user * newstack = compat_ptr(__new);
679 stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; 675 stack_32_t __user * oldstack = compat_ptr(__old);
680 stack_t uss, uoss; 676 stack_t uss, uoss;
681 int ret; 677 int ret;
682 mm_segment_t old_fs; 678 mm_segment_t old_fs;
@@ -708,7 +704,7 @@ int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
708 set_fs(old_fs); 704 set_fs(old_fs);
709 /* Copy the stack information to the user output buffer */ 705 /* Copy the stack information to the user output buffer */
710 if (!ret && oldstack && 706 if (!ret && oldstack &&
711 (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || 707 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
712 __put_user(uoss.ss_flags, &oldstack->ss_flags) || 708 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
713 __put_user(uoss.ss_size, &oldstack->ss_size))) 709 __put_user(uoss.ss_size, &oldstack->ss_size)))
714 return -EFAULT; 710 return -EFAULT;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index b3193116e686..497a5d3df359 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -60,8 +60,8 @@ struct rt_sigframe {
60 struct ucontext uc; 60 struct ucontext uc;
61 unsigned long _unused[2]; 61 unsigned long _unused[2];
62 unsigned int tramp[TRAMP_SIZE]; 62 unsigned int tramp[TRAMP_SIZE];
63 struct siginfo *pinfo; 63 struct siginfo __user *pinfo;
64 void *puc; 64 void __user *puc;
65 struct siginfo info; 65 struct siginfo info;
66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ 66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */
67 char abigap[288]; 67 char abigap[288];
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f671ed253901..de3f30e6b333 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -136,14 +136,14 @@ static void __init fixup_bus_range(struct device_node *bridge)
136 |(((unsigned int)(off)) & 0xFCUL) \ 136 |(((unsigned int)(off)) & 0xFCUL) \
137 |1UL) 137 |1UL)
138 138
139static unsigned long macrisc_cfg_access(struct pci_controller* hose, 139static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose,
140 u8 bus, u8 dev_fn, u8 offset) 140 u8 bus, u8 dev_fn, u8 offset)
141{ 141{
142 unsigned int caddr; 142 unsigned int caddr;
143 143
144 if (bus == hose->first_busno) { 144 if (bus == hose->first_busno) {
145 if (dev_fn < (11 << 3)) 145 if (dev_fn < (11 << 3))
146 return 0; 146 return NULL;
147 caddr = MACRISC_CFA0(dev_fn, offset); 147 caddr = MACRISC_CFA0(dev_fn, offset);
148 } else 148 } else
149 caddr = MACRISC_CFA1(bus, dev_fn, offset); 149 caddr = MACRISC_CFA1(bus, dev_fn, offset);
@@ -154,14 +154,14 @@ static unsigned long macrisc_cfg_access(struct pci_controller* hose,
154 } while (in_le32(hose->cfg_addr) != caddr); 154 } while (in_le32(hose->cfg_addr) != caddr);
155 155
156 offset &= has_uninorth ? 0x07 : 0x03; 156 offset &= has_uninorth ? 0x07 : 0x03;
157 return ((unsigned long)hose->cfg_data) + offset; 157 return hose->cfg_data + offset;
158} 158}
159 159
160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
161 int offset, int len, u32 *val) 161 int offset, int len, u32 *val)
162{ 162{
163 struct pci_controller *hose; 163 struct pci_controller *hose;
164 unsigned long addr; 164 volatile void __iomem *addr;
165 165
166 hose = pci_bus_to_host(bus); 166 hose = pci_bus_to_host(bus);
167 if (hose == NULL) 167 if (hose == NULL)
@@ -177,13 +177,13 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
177 */ 177 */
178 switch (len) { 178 switch (len) {
179 case 1: 179 case 1:
180 *val = in_8((u8 *)addr); 180 *val = in_8(addr);
181 break; 181 break;
182 case 2: 182 case 2:
183 *val = in_le16((u16 *)addr); 183 *val = in_le16(addr);
184 break; 184 break;
185 default: 185 default:
186 *val = in_le32((u32 *)addr); 186 *val = in_le32(addr);
187 break; 187 break;
188 } 188 }
189 return PCIBIOS_SUCCESSFUL; 189 return PCIBIOS_SUCCESSFUL;
@@ -193,7 +193,7 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
193 int offset, int len, u32 val) 193 int offset, int len, u32 val)
194{ 194{
195 struct pci_controller *hose; 195 struct pci_controller *hose;
196 unsigned long addr; 196 volatile void __iomem *addr;
197 197
198 hose = pci_bus_to_host(bus); 198 hose = pci_bus_to_host(bus);
199 if (hose == NULL) 199 if (hose == NULL)
@@ -209,16 +209,16 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
209 */ 209 */
210 switch (len) { 210 switch (len) {
211 case 1: 211 case 1:
212 out_8((u8 *)addr, val); 212 out_8(addr, val);
213 (void) in_8((u8 *)addr); 213 (void) in_8(addr);
214 break; 214 break;
215 case 2: 215 case 2:
216 out_le16((u16 *)addr, val); 216 out_le16(addr, val);
217 (void) in_le16((u16 *)addr); 217 (void) in_le16(addr);
218 break; 218 break;
219 default: 219 default:
220 out_le32((u32 *)addr, val); 220 out_le32(addr, val);
221 (void) in_le32((u32 *)addr); 221 (void) in_le32(addr);
222 break; 222 break;
223 } 223 }
224 return PCIBIOS_SUCCESSFUL; 224 return PCIBIOS_SUCCESSFUL;
@@ -348,25 +348,23 @@ static int u3_ht_skip_device(struct pci_controller *hose,
348 + (((unsigned int)bus) << 16) \ 348 + (((unsigned int)bus) << 16) \
349 + 0x01000000UL) 349 + 0x01000000UL)
350 350
351static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 351static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose,
352 u8 bus, u8 devfn, u8 offset) 352 u8 bus, u8 devfn, u8 offset)
353{ 353{
354 if (bus == hose->first_busno) { 354 if (bus == hose->first_busno) {
355 /* For now, we don't self probe U3 HT bridge */ 355 /* For now, we don't self probe U3 HT bridge */
356 if (PCI_SLOT(devfn) == 0) 356 if (PCI_SLOT(devfn) == 0)
357 return 0; 357 return NULL;
358 return ((unsigned long)hose->cfg_data) + 358 return hose->cfg_data + U3_HT_CFA0(devfn, offset);
359 U3_HT_CFA0(devfn, offset);
360 } else 359 } else
361 return ((unsigned long)hose->cfg_data) + 360 return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
362 U3_HT_CFA1(bus, devfn, offset);
363} 361}
364 362
365static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 363static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
366 int offset, int len, u32 *val) 364 int offset, int len, u32 *val)
367{ 365{
368 struct pci_controller *hose; 366 struct pci_controller *hose;
369 unsigned long addr; 367 volatile void __iomem *addr;
370 368
371 hose = pci_bus_to_host(bus); 369 hose = pci_bus_to_host(bus);
372 if (hose == NULL) 370 if (hose == NULL)
@@ -400,13 +398,13 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
400 */ 398 */
401 switch (len) { 399 switch (len) {
402 case 1: 400 case 1:
403 *val = in_8((u8 *)addr); 401 *val = in_8(addr);
404 break; 402 break;
405 case 2: 403 case 2:
406 *val = in_le16((u16 *)addr); 404 *val = in_le16(addr);
407 break; 405 break;
408 default: 406 default:
409 *val = in_le32((u32 *)addr); 407 *val = in_le32(addr);
410 break; 408 break;
411 } 409 }
412 return PCIBIOS_SUCCESSFUL; 410 return PCIBIOS_SUCCESSFUL;
@@ -416,7 +414,7 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
416 int offset, int len, u32 val) 414 int offset, int len, u32 val)
417{ 415{
418 struct pci_controller *hose; 416 struct pci_controller *hose;
419 unsigned long addr; 417 volatile void __iomem *addr;
420 418
421 hose = pci_bus_to_host(bus); 419 hose = pci_bus_to_host(bus);
422 if (hose == NULL) 420 if (hose == NULL)
@@ -442,16 +440,16 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
442 */ 440 */
443 switch (len) { 441 switch (len) {
444 case 1: 442 case 1:
445 out_8((u8 *)addr, val); 443 out_8(addr, val);
446 (void) in_8((u8 *)addr); 444 (void) in_8(addr);
447 break; 445 break;
448 case 2: 446 case 2:
449 out_le16((u16 *)addr, val); 447 out_le16(addr, val);
450 (void) in_le16((u16 *)addr); 448 (void) in_le16(addr);
451 break; 449 break;
452 default: 450 default:
453 out_le32((u32 *)addr, val); 451 out_le32((u32 __iomem *)addr, val);
454 (void) in_le32((u32 *)addr); 452 (void) in_le32(addr);
455 break; 453 break;
456 } 454 }
457 return PCIBIOS_SUCCESSFUL; 455 return PCIBIOS_SUCCESSFUL;
@@ -476,7 +474,7 @@ static struct pci_ops u3_ht_pci_ops =
476 |(((unsigned int)(off)) & 0xfcU) \ 474 |(((unsigned int)(off)) & 0xfcU) \
477 |1UL) 475 |1UL)
478 476
479static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, 477static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose,
480 u8 bus, u8 dev_fn, int offset) 478 u8 bus, u8 dev_fn, int offset)
481{ 479{
482 unsigned int caddr; 480 unsigned int caddr;
@@ -492,14 +490,14 @@ static unsigned long u4_pcie_cfg_access(struct pci_controller* hose,
492 } while (in_le32(hose->cfg_addr) != caddr); 490 } while (in_le32(hose->cfg_addr) != caddr);
493 491
494 offset &= 0x03; 492 offset &= 0x03;
495 return ((unsigned long)hose->cfg_data) + offset; 493 return hose->cfg_data + offset;
496} 494}
497 495
498static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 496static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
499 int offset, int len, u32 *val) 497 int offset, int len, u32 *val)
500{ 498{
501 struct pci_controller *hose; 499 struct pci_controller *hose;
502 unsigned long addr; 500 volatile void __iomem *addr;
503 501
504 hose = pci_bus_to_host(bus); 502 hose = pci_bus_to_host(bus);
505 if (hose == NULL) 503 if (hose == NULL)
@@ -515,13 +513,13 @@ static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
515 */ 513 */
516 switch (len) { 514 switch (len) {
517 case 1: 515 case 1:
518 *val = in_8((u8 *)addr); 516 *val = in_8(addr);
519 break; 517 break;
520 case 2: 518 case 2:
521 *val = in_le16((u16 *)addr); 519 *val = in_le16(addr);
522 break; 520 break;
523 default: 521 default:
524 *val = in_le32((u32 *)addr); 522 *val = in_le32(addr);
525 break; 523 break;
526 } 524 }
527 return PCIBIOS_SUCCESSFUL; 525 return PCIBIOS_SUCCESSFUL;
@@ -531,7 +529,7 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
531 int offset, int len, u32 val) 529 int offset, int len, u32 val)
532{ 530{
533 struct pci_controller *hose; 531 struct pci_controller *hose;
534 unsigned long addr; 532 volatile void __iomem *addr;
535 533
536 hose = pci_bus_to_host(bus); 534 hose = pci_bus_to_host(bus);
537 if (hose == NULL) 535 if (hose == NULL)
@@ -547,16 +545,16 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
547 */ 545 */
548 switch (len) { 546 switch (len) {
549 case 1: 547 case 1:
550 out_8((u8 *)addr, val); 548 out_8(addr, val);
551 (void) in_8((u8 *)addr); 549 (void) in_8(addr);
552 break; 550 break;
553 case 2: 551 case 2:
554 out_le16((u16 *)addr, val); 552 out_le16(addr, val);
555 (void) in_le16((u16 *)addr); 553 (void) in_le16(addr);
556 break; 554 break;
557 default: 555 default:
558 out_le32((u32 *)addr, val); 556 out_le32(addr, val);
559 (void) in_le32((u32 *)addr); 557 (void) in_le32(addr);
560 break; 558 break;
561 } 559 }
562 return PCIBIOS_SUCCESSFUL; 560 return PCIBIOS_SUCCESSFUL;
@@ -773,8 +771,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
773 * the reg address cell, we shall fix that by killing struct 771 * the reg address cell, we shall fix that by killing struct
774 * reg_property and using some accessor functions instead 772 * reg_property and using some accessor functions instead
775 */ 773 */
776 hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 774 hose->cfg_data = ioremap(0xf2000000, 0x02000000);
777 0x02000000);
778 775
779 /* 776 /*
780 * /ht node doesn't expose a "ranges" property, so we "remove" 777 * /ht node doesn't expose a "ranges" property, so we "remove"
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 977de9db8754..6298264efe36 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -59,7 +59,7 @@ static unsigned long dart_tablesize;
59static u32 *dart_vbase; 59static u32 *dart_vbase;
60 60
61/* Mapped base address for the dart */ 61/* Mapped base address for the dart */
62static unsigned int *__iomem dart; 62static unsigned int __iomem *dart;
63 63
64/* Dummy val that entries are set to when unused */ 64/* Dummy val that entries are set to when unused */
65static unsigned int dart_emptyval; 65static unsigned int dart_emptyval;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index bf9a7a361b34..cc20f0e3a7d3 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -100,12 +100,12 @@
100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
102 102
103asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) 103asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
104{ 104{
105 return sys_chown(filename, low2highuid(user), low2highgid(group)); 105 return sys_chown(filename, low2highuid(user), low2highgid(group));
106} 106}
107 107
108asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) 108asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
109{ 109{
110 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 110 return sys_lchown(filename, low2highuid(user), low2highgid(group));
111} 111}
@@ -141,7 +141,7 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
141 low2highuid(suid)); 141 low2highuid(suid));
142} 142}
143 143
144asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) 144asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
145{ 145{
146 int retval; 146 int retval;
147 147
@@ -158,7 +158,7 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
158 low2highgid(sgid)); 158 low2highgid(sgid));
159} 159}
160 160
161asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) 161asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
162{ 162{
163 int retval; 163 int retval;
164 164
@@ -179,7 +179,7 @@ asmlinkage long sys32_setfsgid16(u16 gid)
179 return sys_setfsgid((gid_t)gid); 179 return sys_setfsgid((gid_t)gid);
180} 180}
181 181
182static int groups16_to_user(u16 *grouplist, struct group_info *group_info) 182static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
183{ 183{
184 int i; 184 int i;
185 u16 group; 185 u16 group;
@@ -193,7 +193,7 @@ static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
193 return 0; 193 return 0;
194} 194}
195 195
196static int groups16_from_user(struct group_info *group_info, u16 *grouplist) 196static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
197{ 197{
198 int i; 198 int i;
199 u16 group; 199 u16 group;
@@ -207,7 +207,7 @@ static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
207 return 0; 207 return 0;
208} 208}
209 209
210asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) 210asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
211{ 211{
212 int i; 212 int i;
213 213
@@ -231,7 +231,7 @@ out:
231 return i; 231 return i;
232} 232}
233 233
234asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) 234asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
235{ 235{
236 struct group_info *group_info; 236 struct group_info *group_info;
237 int retval; 237 int retval;
@@ -278,14 +278,14 @@ asmlinkage long sys32_getegid16(void)
278 278
279/* 32-bit timeval and related flotsam. */ 279/* 32-bit timeval and related flotsam. */
280 280
281static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
282{ 282{
283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) || 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
284 (__get_user(o->tv_sec, &i->tv_sec) || 284 (__get_user(o->tv_sec, &i->tv_sec) ||
285 __get_user(o->tv_usec, &i->tv_usec))); 285 __get_user(o->tv_usec, &i->tv_usec)));
286} 286}
287 287
288static inline long put_tv32(struct compat_timeval *o, struct timeval *i) 288static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
289{ 289{
290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
291 (__put_user(i->tv_sec, &o->tv_sec) || 291 (__put_user(i->tv_sec, &o->tv_sec) ||
@@ -341,7 +341,7 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
341 return -ENOSYS; 341 return -ENOSYS;
342} 342}
343 343
344asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low) 344asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
345{ 345{
346 if ((int)high < 0) 346 if ((int)high < 0)
347 return -EINVAL; 347 return -EINVAL;
@@ -357,7 +357,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
357 return sys_ftruncate(fd, (high << 32) | low); 357 return sys_ftruncate(fd, (high << 32) | low);
358} 358}
359 359
360int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 360int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
361{ 361{
362 int err; 362 int err;
363 363
@@ -591,7 +591,7 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
591 591
592extern struct timezone sys_tz; 592extern struct timezone sys_tz;
593 593
594asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 594asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
595{ 595{
596 if (tv) { 596 if (tv) {
597 struct timeval ktv; 597 struct timeval ktv;
@@ -606,7 +606,7 @@ asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *t
606 return 0; 606 return 0;
607} 607}
608 608
609static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 609static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
610{ 610{
611 long usec; 611 long usec;
612 612
@@ -620,7 +620,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
620 return 0; 620 return 0;
621} 621}
622 622
623asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 623asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
624{ 624{
625 struct timespec kts; 625 struct timespec kts;
626 struct timezone ktz; 626 struct timezone ktz;
@@ -645,7 +645,7 @@ asmlinkage long sys32_pause(void)
645 return -ERESTARTNOHAND; 645 return -ERESTARTNOHAND;
646} 646}
647 647
648asmlinkage long sys32_pread64(unsigned int fd, char *ubuf, 648asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
649 size_t count, u32 poshi, u32 poslo) 649 size_t count, u32 poshi, u32 poslo)
650{ 650{
651 if ((compat_ssize_t) count < 0) 651 if ((compat_ssize_t) count < 0)
@@ -653,7 +653,7 @@ asmlinkage long sys32_pread64(unsigned int fd, char *ubuf,
653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
654} 654}
655 655
656asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf, 656asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
657 size_t count, u32 poshi, u32 poslo) 657 size_t count, u32 poshi, u32 poslo)
658{ 658{
659 if ((compat_ssize_t) count < 0) 659 if ((compat_ssize_t) count < 0)
@@ -666,7 +666,7 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
667} 667}
668 668
669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count) 669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
670{ 670{
671 mm_segment_t old_fs = get_fs(); 671 mm_segment_t old_fs = get_fs();
672 int ret; 672 int ret;
@@ -686,7 +686,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
686} 686}
687 687
688asmlinkage long sys32_sendfile64(int out_fd, int in_fd, 688asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
689 compat_loff_t *offset, s32 count) 689 compat_loff_t __user *offset, s32 count)
690{ 690{
691 mm_segment_t old_fs = get_fs(); 691 mm_segment_t old_fs = get_fs();
692 int ret; 692 int ret;
@@ -722,7 +722,7 @@ struct timex32 {
722 722
723extern int do_adjtimex(struct timex *); 723extern int do_adjtimex(struct timex *);
724 724
725asmlinkage long sys32_adjtimex(struct timex32 *utp) 725asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
726{ 726{
727 struct timex txc; 727 struct timex txc;
728 int ret; 728 int ret;
@@ -789,12 +789,13 @@ struct __sysctl_args32 {
789 u32 __unused[4]; 789 u32 __unused[4];
790}; 790};
791 791
792asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) 792asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
793{ 793{
794 struct __sysctl_args32 tmp; 794 struct __sysctl_args32 tmp;
795 int error; 795 int error;
796 size_t oldlen, *oldlenp = NULL; 796 size_t oldlen;
797 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 797 size_t __user *oldlenp = NULL;
798 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
798 799
799 if (copy_from_user(&tmp, args, sizeof(tmp))) 800 if (copy_from_user(&tmp, args, sizeof(tmp)))
800 return -EFAULT; 801 return -EFAULT;
@@ -806,20 +807,20 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
806 basically copy the whole sysctl.c here, and 807 basically copy the whole sysctl.c here, and
807 glibc's __sysctl uses rw memory for the structure 808 glibc's __sysctl uses rw memory for the structure
808 anyway. */ 809 anyway. */
809 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 810 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
810 put_user(oldlen, (size_t *)addr)) 811 put_user(oldlen, (size_t __user *)addr))
811 return -EFAULT; 812 return -EFAULT;
812 oldlenp = (size_t *)addr; 813 oldlenp = (size_t __user *)addr;
813 } 814 }
814 815
815 lock_kernel(); 816 lock_kernel();
816 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 817 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
817 oldlenp, (void *)A(tmp.newval), tmp.newlen); 818 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
818 unlock_kernel(); 819 unlock_kernel();
819 if (oldlenp) { 820 if (oldlenp) {
820 if (!error) { 821 if (!error) {
821 if (get_user(oldlen, (size_t *)addr) || 822 if (get_user(oldlen, (size_t __user *)addr) ||
822 put_user(oldlen, (u32 *)A(tmp.oldlenp))) 823 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
823 error = -EFAULT; 824 error = -EFAULT;
824 } 825 }
825 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 826 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -853,7 +854,7 @@ struct stat64_emu31 {
853 unsigned long st_ino; 854 unsigned long st_ino;
854}; 855};
855 856
856static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat) 857static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
857{ 858{
858 struct stat64_emu31 tmp; 859 struct stat64_emu31 tmp;
859 860
@@ -877,7 +878,7 @@ static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat)
877 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 878 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
878} 879}
879 880
880asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf) 881asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf)
881{ 882{
882 struct kstat stat; 883 struct kstat stat;
883 int ret = vfs_stat(filename, &stat); 884 int ret = vfs_stat(filename, &stat);
@@ -886,7 +887,7 @@ asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf)
886 return ret; 887 return ret;
887} 888}
888 889
889asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf) 890asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf)
890{ 891{
891 struct kstat stat; 892 struct kstat stat;
892 int ret = vfs_lstat(filename, &stat); 893 int ret = vfs_lstat(filename, &stat);
@@ -895,7 +896,7 @@ asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf)
895 return ret; 896 return ret;
896} 897}
897 898
898asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf) 899asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf)
899{ 900{
900 struct kstat stat; 901 struct kstat stat;
901 int ret = vfs_fstat(fd, &stat); 902 int ret = vfs_fstat(fd, &stat);
@@ -952,7 +953,7 @@ out:
952 953
953 954
954asmlinkage unsigned long 955asmlinkage unsigned long
955old32_mmap(struct mmap_arg_struct_emu31 *arg) 956old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
956{ 957{
957 struct mmap_arg_struct_emu31 a; 958 struct mmap_arg_struct_emu31 a;
958 int error = -EFAULT; 959 int error = -EFAULT;
@@ -970,7 +971,7 @@ out:
970} 971}
971 972
972asmlinkage long 973asmlinkage long
973sys32_mmap2(struct mmap_arg_struct_emu31 *arg) 974sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
974{ 975{
975 struct mmap_arg_struct_emu31 a; 976 struct mmap_arg_struct_emu31 a;
976 int error = -EFAULT; 977 int error = -EFAULT;
@@ -982,7 +983,7 @@ out:
982 return error; 983 return error;
983} 984}
984 985
985asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count) 986asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
986{ 987{
987 if ((compat_ssize_t) count < 0) 988 if ((compat_ssize_t) count < 0)
988 return -EINVAL; 989 return -EINVAL;
@@ -990,7 +991,7 @@ asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count)
990 return sys_read(fd, buf, count); 991 return sys_read(fd, buf, count);
991} 992}
992 993
993asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count) 994asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
994{ 995{
995 if ((compat_ssize_t) count < 0) 996 if ((compat_ssize_t) count < 0)
996 return -EINVAL; 997 return -EINVAL;
@@ -1002,12 +1003,12 @@ asmlinkage long sys32_clone(struct pt_regs regs)
1002{ 1003{
1003 unsigned long clone_flags; 1004 unsigned long clone_flags;
1004 unsigned long newsp; 1005 unsigned long newsp;
1005 int *parent_tidptr, *child_tidptr; 1006 int __user *parent_tidptr, *child_tidptr;
1006 1007
1007 clone_flags = regs.gprs[3] & 0xffffffffUL; 1008 clone_flags = regs.gprs[3] & 0xffffffffUL;
1008 newsp = regs.orig_gpr2 & 0x7fffffffUL; 1009 newsp = regs.orig_gpr2 & 0x7fffffffUL;
1009 parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); 1010 parent_tidptr = compat_ptr(regs.gprs[4]);
1010 child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); 1011 child_tidptr = compat_ptr(regs.gprs[5]);
1011 if (!newsp) 1012 if (!newsp)
1012 newsp = regs.gprs[15]; 1013 newsp = regs.gprs[15];
1013 return do_fork(clone_flags, newsp, &regs, 0, 1014 return do_fork(clone_flags, newsp, &regs, 0,
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 6a63553493c5..e351780bb660 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -122,8 +122,8 @@ out:
122#ifndef CONFIG_64BIT 122#ifndef CONFIG_64BIT
123struct sel_arg_struct { 123struct sel_arg_struct {
124 unsigned long n; 124 unsigned long n;
125 fd_set *inp, *outp, *exp; 125 fd_set __user *inp, *outp, *exp;
126 struct timeval *tvp; 126 struct timeval __user *tvp;
127}; 127};
128 128
129asmlinkage long old_select(struct sel_arg_struct __user *arg) 129asmlinkage long old_select(struct sel_arg_struct __user *arg)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5d21e9e6e7b4..a46793beeddd 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -486,7 +486,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
486 info.si_signo = signal; 486 info.si_signo = signal;
487 info.si_errno = 0; 487 info.si_errno = 0;
488 info.si_code = ILL_ILLOPC; 488 info.si_code = ILL_ILLOPC;
489 info.si_addr = (void *) location; 489 info.si_addr = (void __user *) location;
490 do_trap(interruption_code, signal, 490 do_trap(interruption_code, signal,
491 "illegal operation", regs, &info); 491 "illegal operation", regs, &info);
492 } 492 }
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c
index c46f9154cfd5..123abbbc91e0 100644
--- a/arch/sh/boards/renesas/rts7751r2d/io.c
+++ b/arch/sh/boards/renesas/rts7751r2d/io.c
@@ -216,24 +216,26 @@ void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count)
216{ 216{
217 volatile __u8 *bp; 217 volatile __u8 *bp;
218 volatile __u16 *p; 218 volatile __u16 *p;
219 unsigned char *s = addr;
219 220
220 if (CHECK_AX88796L_PORT(port)) { 221 if (CHECK_AX88796L_PORT(port)) {
221 p = (volatile unsigned short *)port88796l(port, 0); 222 p = (volatile unsigned short *)port88796l(port, 0);
222 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 223 while (count--) *s++ = *p & 0xff;
223 } else if (PXSEG(port)) 224 } else if (PXSEG(port))
224 while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; 225 while (count--) *s++ = *(volatile unsigned char *)port;
225 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 226 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
226 bp = (__u8 *)PCI_IOMAP(port); 227 bp = (__u8 *)PCI_IOMAP(port);
227 while (count--) *((volatile unsigned char *) addr)++ = *bp; 228 while (count--) *s++ = *bp;
228 } else { 229 } else {
229 p = (volatile unsigned short *)port2adr(port); 230 p = (volatile unsigned short *)port2adr(port);
230 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 231 while (count--) *s++ = *p & 0xff;
231 } 232 }
232} 233}
233 234
234void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) 235void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
235{ 236{
236 volatile __u16 *p; 237 volatile __u16 *p;
238 __u16 *s = addr;
237 239
238 if (CHECK_AX88796L_PORT(port)) 240 if (CHECK_AX88796L_PORT(port))
239 p = (volatile unsigned short *)port88796l(port, 1); 241 p = (volatile unsigned short *)port88796l(port, 1);
@@ -243,7 +245,7 @@ void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
243 p = (volatile unsigned short *)PCI_IOMAP(port); 245 p = (volatile unsigned short *)PCI_IOMAP(port);
244 else 246 else
245 p = (volatile unsigned short *)port2adr(port); 247 p = (volatile unsigned short *)port2adr(port);
246 while (count--) *((__u16 *) addr)++ = *p; 248 while (count--) *s++ = *p;
247} 249}
248 250
249void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) 251void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
@@ -252,8 +254,9 @@ void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
252 maybebadio(insl, port); 254 maybebadio(insl, port);
253 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 255 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
254 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 256 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
257 __u32 *s = addr;
255 258
256 while (count--) *((__u32 *) addr)++ = *p; 259 while (count--) *s++ = *p;
257 } else 260 } else
258 maybebadio(insl, port); 261 maybebadio(insl, port);
259} 262}
@@ -262,24 +265,26 @@ void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count)
262{ 265{
263 volatile __u8 *bp; 266 volatile __u8 *bp;
264 volatile __u16 *p; 267 volatile __u16 *p;
268 const __u8 *s = addr;
265 269
266 if (CHECK_AX88796L_PORT(port)) { 270 if (CHECK_AX88796L_PORT(port)) {
267 p = (volatile unsigned short *)port88796l(port, 0); 271 p = (volatile unsigned short *)port88796l(port, 0);
268 while (count--) *p = *((unsigned char *) addr)++; 272 while (count--) *p = *s++;
269 } else if (PXSEG(port)) 273 } else if (PXSEG(port))
270 while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; 274 while (count--) *(volatile unsigned char *)port = *s++;
271 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 275 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
272 bp = (__u8 *)PCI_IOMAP(port); 276 bp = (__u8 *)PCI_IOMAP(port);
273 while (count--) *bp = *((volatile unsigned char *) addr)++; 277 while (count--) *bp = *s++;
274 } else { 278 } else {
275 p = (volatile unsigned short *)port2adr(port); 279 p = (volatile unsigned short *)port2adr(port);
276 while (count--) *p = *((unsigned char *) addr)++; 280 while (count--) *p = *s++;
277 } 281 }
278} 282}
279 283
280void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) 284void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
281{ 285{
282 volatile __u16 *p; 286 volatile __u16 *p;
287 const __u16 *s = addr;
283 288
284 if (CHECK_AX88796L_PORT(port)) 289 if (CHECK_AX88796L_PORT(port))
285 p = (volatile unsigned short *)port88796l(port, 1); 290 p = (volatile unsigned short *)port88796l(port, 1);
@@ -289,7 +294,7 @@ void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
289 p = (volatile unsigned short *)PCI_IOMAP(port); 294 p = (volatile unsigned short *)PCI_IOMAP(port);
290 else 295 else
291 p = (volatile unsigned short *)port2adr(port); 296 p = (volatile unsigned short *)port2adr(port);
292 while (count--) *p = *((__u16 *) addr)++; 297 while (count--) *p = *s++;
293} 298}
294 299
295void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) 300void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
@@ -298,8 +303,9 @@ void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
298 maybebadio(outsl, port); 303 maybebadio(outsl, port);
299 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 304 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
300 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 305 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
306 const __u32 *s = addr;
301 307
302 while (count--) *p = *((__u32 *) addr)++; 308 while (count--) *p = *s++;
303 } else 309 } else
304 maybebadio(outsl, port); 310 maybebadio(outsl, port);
305} 311}
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 4c67727d75b1..05ba410682a3 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -222,7 +222,7 @@ config SYNCLINKMP
222 222
223config SYNCLINK_GT 223config SYNCLINK_GT
224 tristate "SyncLink GT/AC support" 224 tristate "SyncLink GT/AC support"
225 depends on SERIAL_NONSTANDARD 225 depends on SERIAL_NONSTANDARD && PCI
226 help 226 help
227 Support for SyncLink GT and SyncLink AC families of 227 Support for SyncLink GT and SyncLink AC families of
228 synchronous and asynchronous serial adapters 228 synchronous and asynchronous serial adapters
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 0ef560144be3..6dfc94122dd9 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -351,7 +351,7 @@ config HISAX_ENTERNOW_PCI
351 351
352config HISAX_AMD7930 352config HISAX_AMD7930
353 bool "Am7930 (EXPERIMENTAL)" 353 bool "Am7930 (EXPERIMENTAL)"
354 depends on EXPERIMENTAL && SPARC 354 depends on EXPERIMENTAL && SPARC && BROKEN
355 help 355 help
356 This enables HiSax support for the AMD7930 chips on some SPARCs. 356 This enables HiSax support for the AMD7930 chips on some SPARCs.
357 This code is not finished yet. 357 This code is not finished yet.
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 297c32ab51e3..840fe0177121 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -167,29 +167,32 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
167 if (kp->clipcount > 2048) 167 if (kp->clipcount > 2048)
168 return -EINVAL; 168 return -EINVAL;
169 if (kp->clipcount) { 169 if (kp->clipcount) {
170 struct v4l2_clip32 *uclips = compat_ptr(up->clips); 170 struct v4l2_clip32 __user *uclips;
171 struct v4l2_clip *kclips; 171 struct v4l2_clip __user *kclips;
172 int n = kp->clipcount; 172 int n = kp->clipcount;
173 compat_caddr_t p;
173 174
175 if (get_user(p, &up->clips))
176 return -EFAULT;
177 uclips = compat_ptr(p);
174 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip)); 178 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
175 kp->clips = kclips; 179 kp->clips = kclips;
176 while (--n >= 0) { 180 while (--n >= 0) {
177 if (!access_ok(VERIFY_READ, &uclips->c, sizeof(uclips->c)) || 181 if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
178 copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c))) 182 return -EFAULT;
183 if (put_user(n ? kclips + 1 : NULL, &kclips->next))
179 return -EFAULT; 184 return -EFAULT;
180 kclips->next = n ? kclips + 1 : 0;
181 uclips += 1; 185 uclips += 1;
182 kclips += 1; 186 kclips += 1;
183 } 187 }
184 } else 188 } else
185 kp->clips = 0; 189 kp->clips = NULL;
186 return 0; 190 return 0;
187} 191}
188 192
189static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) 193static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
190{ 194{
191 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_window32)) || 195 if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
192 copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
193 put_user(kp->field, &up->field) || 196 put_user(kp->field, &up->field) ||
194 put_user(kp->chromakey, &up->chromakey) || 197 put_user(kp->chromakey, &up->chromakey) ||
195 put_user(kp->clipcount, &up->clipcount)) 198 put_user(kp->clipcount, &up->clipcount))
@@ -199,33 +202,29 @@ static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
199 202
200static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 203static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
201{ 204{
202 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_pix_format)) || 205 if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
203 copy_from_user(kp, up, sizeof(struct v4l2_pix_format))) 206 return -EFAULT;
204 return -EFAULT;
205 return 0; 207 return 0;
206} 208}
207 209
208static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 210static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
209{ 211{
210 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_pix_format)) || 212 if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
211 copy_to_user(up, kp, sizeof(struct v4l2_pix_format))) 213 return -EFAULT;
212 return -EFAULT;
213 return 0; 214 return 0;
214} 215}
215 216
216static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 217static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
217{ 218{
218 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_vbi_format)) || 219 if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
219 copy_from_user(kp, up, sizeof(struct v4l2_vbi_format))) 220 return -EFAULT;
220 return -EFAULT;
221 return 0; 221 return 0;
222} 222}
223 223
224static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 224static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
225{ 225{
226 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_vbi_format)) || 226 if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
227 copy_to_user(up, kp, sizeof(struct v4l2_vbi_format))) 227 return -EFAULT;
228 return -EFAULT;
229 return 0; 228 return 0;
230} 229}
231 230
@@ -279,18 +278,16 @@ static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
279 278
280static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 279static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
281{ 280{
282 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard)) || 281 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
283 copy_from_user(kp, up, sizeof(struct v4l2_standard))) 282 return -EFAULT;
284 return -EFAULT;
285 return 0; 283 return 0;
286 284
287} 285}
288 286
289static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 287static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
290{ 288{
291 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard)) || 289 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
292 copy_to_user(up, kp, sizeof(struct v4l2_standard))) 290 return -EFAULT;
293 return -EFAULT;
294 return 0; 291 return 0;
295} 292}
296 293
@@ -328,18 +325,16 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
328 325
329static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 326static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
330{ 327{
331 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_tuner)) || 328 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
332 copy_from_user(kp, up, sizeof(struct v4l2_tuner))) 329 return -EFAULT;
333 return -EFAULT;
334 return 0; 330 return 0;
335 331
336} 332}
337 333
338static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 334static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
339{ 335{
340 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_tuner)) || 336 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
341 copy_to_user(up, kp, sizeof(struct v4l2_tuner))) 337 return -EFAULT;
342 return -EFAULT;
343 return 0; 338 return 0;
344} 339}
345 340
@@ -380,11 +375,13 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
380 break; 375 break;
381 case V4L2_MEMORY_USERPTR: 376 case V4L2_MEMORY_USERPTR:
382 { 377 {
383 unsigned long tmp = (unsigned long)compat_ptr(up->m.userptr); 378 compat_long_t tmp;
384 379
385 if(get_user(kp->length, &up->length) || 380 if (get_user(kp->length, &up->length) ||
386 get_user(kp->m.userptr, &tmp)) 381 get_user(tmp, &up->m.userptr))
387 return -EFAULT; 382 return -EFAULT;
383
384 kp->m.userptr = (unsigned long)compat_ptr(tmp);
388 } 385 }
389 break; 386 break;
390 case V4L2_MEMORY_OVERLAY: 387 case V4L2_MEMORY_OVERLAY:
@@ -468,33 +465,29 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
468 465
469static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 466static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
470{ 467{
471 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input) - 4) || 468 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
472 copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 469 return -EFAULT;
473 return -EFAULT;
474 return 0; 470 return 0;
475} 471}
476 472
477static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 473static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
478{ 474{
479 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input) - 4) || 475 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
480 copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 476 return -EFAULT;
481 return -EFAULT;
482 return 0; 477 return 0;
483} 478}
484 479
485static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 480static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
486{ 481{
487 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input)) || 482 if (copy_from_user(kp, up, sizeof(struct v4l2_input)))
488 copy_from_user(kp, up, sizeof(struct v4l2_input))) 483 return -EFAULT;
489 return -EFAULT;
490 return 0; 484 return 0;
491} 485}
492 486
493static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 487static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
494{ 488{
495 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input)) || 489 if (copy_to_user(up, kp, sizeof(struct v4l2_input)))
496 copy_to_user(up, kp, sizeof(struct v4l2_input))) 490 return -EFAULT;
497 return -EFAULT;
498 return 0; 491 return 0;
499} 492}
500 493
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index effa0d7a73ac..205bb7083335 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -301,7 +301,7 @@ config MTD_JEDEC
301 301
302config MTD_XIP 302config MTD_XIP
303 bool "XIP aware MTD support" 303 bool "XIP aware MTD support"
304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM 304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARCH_MTD_XIP
305 default y if XIP_KERNEL 305 default y if XIP_KERNEL
306 help 306 help
307 This allows MTD support to work with flash memory which is also 307 This allows MTD support to work with flash memory which is also
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index c5cd61c7f927..e5bb9f5ae429 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -748,7 +748,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
748 if (essid->length) { 748 if (essid->length) {
749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ 749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
750 /* if it is to big, trunk it */ 750 /* if it is to big, trunk it */
751 dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length); 751 dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length);
752 } else { 752 } else {
753 dwrq->flags = 0; 753 dwrq->flags = 0;
754 dwrq->length = 0; 754 dwrq->length = 0;
diff --git a/drivers/serial/m32r_sio.h b/drivers/serial/m32r_sio.h
index 07d0dd80aa3d..7c3ec24f7e50 100644
--- a/drivers/serial/m32r_sio.h
+++ b/drivers/serial/m32r_sio.h
@@ -37,7 +37,7 @@ struct old_serial_port {
37 unsigned int irq; 37 unsigned int irq;
38 unsigned int flags; 38 unsigned int flags;
39 unsigned char io_type; 39 unsigned char io_type;
40 unsigned char *iomem_base; 40 unsigned char __iomem *iomem_base;
41 unsigned short iomem_reg_shift; 41 unsigned short iomem_reg_shift;
42}; 42};
43 43
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index c70ae81b5d98..12357e1fa558 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -38,10 +38,10 @@ static inline unsigned mcr_pack(unsigned pulse, unsigned sample)
38 38
39static int nic_wait(struct ioc3_driver_data *idd) 39static int nic_wait(struct ioc3_driver_data *idd)
40{ 40{
41 volatile unsigned mcr; 41 unsigned mcr;
42 42
43 do { 43 do {
44 mcr = (volatile unsigned)idd->vma->mcr; 44 mcr = readl(&idd->vma->mcr);
45 } while (!(mcr & 2)); 45 } while (!(mcr & 2));
46 46
47 return mcr & 1; 47 return mcr & 1;
@@ -53,7 +53,7 @@ static int nic_reset(struct ioc3_driver_data *idd)
53 unsigned long flags; 53 unsigned long flags;
54 54
55 local_irq_save(flags); 55 local_irq_save(flags);
56 idd->vma->mcr = mcr_pack(500, 65); 56 writel(mcr_pack(500, 65), &idd->vma->mcr);
57 presence = nic_wait(idd); 57 presence = nic_wait(idd);
58 local_irq_restore(flags); 58 local_irq_restore(flags);
59 59
@@ -68,7 +68,7 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
68 unsigned long flags; 68 unsigned long flags;
69 69
70 local_irq_save(flags); 70 local_irq_save(flags);
71 idd->vma->mcr = mcr_pack(6, 13); 71 writel(mcr_pack(6, 13), &idd->vma->mcr);
72 result = nic_wait(idd); 72 result = nic_wait(idd);
73 local_irq_restore(flags); 73 local_irq_restore(flags);
74 74
@@ -80,9 +80,9 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit) 80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit)
81{ 81{
82 if (bit) 82 if (bit)
83 idd->vma->mcr = mcr_pack(6, 110); 83 writel(mcr_pack(6, 110), &idd->vma->mcr);
84 else 84 else
85 idd->vma->mcr = mcr_pack(80, 30); 85 writel(mcr_pack(80, 30), &idd->vma->mcr);
86 86
87 nic_wait(idd); 87 nic_wait(idd);
88} 88}
@@ -337,7 +337,7 @@ static void probe_nic(struct ioc3_driver_data *idd)
337 int save = 0, loops = 3; 337 int save = 0, loops = 3;
338 unsigned long first, addr; 338 unsigned long first, addr;
339 339
340 idd->vma->gpcr_s = GPCR_MLAN_EN; 340 writel(GPCR_MLAN_EN, &idd->vma->gpcr_s);
341 341
342 while(loops>0) { 342 while(loops>0) {
343 idd->nic_part[0] = 0; 343 idd->nic_part[0] = 0;
@@ -408,7 +408,7 @@ static irqreturn_t ioc3_intr_io(int irq, void *arg, struct pt_regs *regs)
408 408
409 read_lock_irqsave(&ioc3_submodules_lock, flags); 409 read_lock_irqsave(&ioc3_submodules_lock, flags);
410 410
411 if(idd->dual_irq && idd->vma->eisr) { 411 if(idd->dual_irq && readb(&idd->vma->eisr)) {
412 /* send Ethernet IRQ to the driver */ 412 /* send Ethernet IRQ to the driver */
413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] && 413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] &&
414 ioc3_ethernet->intr) { 414 ioc3_ethernet->intr) {
@@ -682,7 +682,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
682 idd->id = ioc3_counter++; 682 idd->id = ioc3_counter++;
683 up_write(&ioc3_devices_rwsem); 683 up_write(&ioc3_devices_rwsem);
684 684
685 idd->gpdr_shadow = idd->vma->gpdr; 685 idd->gpdr_shadow = readl(&idd->vma->gpdr);
686 686
687 /* Read IOC3 NIC contents */ 687 /* Read IOC3 NIC contents */
688 probe_nic(idd); 688 probe_nic(idd);
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5dd0207ffd46..057e60217fc5 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -931,8 +931,8 @@ struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
932{ 932{
933 int err, i; 933 int err, i;
934 sg_req_info_t *r; 934 sg_req_info_t __user *r;
935 struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; 935 struct compat_sg_req_info __user *o = (void __user *)arg;
936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); 936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);
937 err = sys_ioctl(fd,cmd,(unsigned long)r); 937 err = sys_ioctl(fd,cmd,(unsigned long)r);
938 if (err < 0) 938 if (err < 0)
@@ -2739,8 +2739,8 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
2739static int 2739static int
2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
2741{ 2741{
2742 struct compat_timeval *tc = (struct compat_timeval *)arg; 2742 struct compat_timeval __user *tc = (struct compat_timeval __user *)arg;
2743 struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval)); 2743 struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval));
2744 struct timeval ts; 2744 struct timeval ts;
2745 if (get_user(ts.tv_sec, &tc->tv_sec) || 2745 if (get_user(ts.tv_sec, &tc->tv_sec) ||
2746 get_user(ts.tv_usec, &tc->tv_usec) || 2746 get_user(ts.tv_usec, &tc->tv_usec) ||
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index a9fa1254894a..6c0aae5151a6 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -56,38 +56,38 @@
56 * variations of functions: non-prefixed ones that preserve the value 56 * variations of functions: non-prefixed ones that preserve the value
57 * and prefixed ones that preserve byte addresses. The latters are 57 * and prefixed ones that preserve byte addresses. The latters are
58 * typically used for moving raw data between a peripheral and memory (cf. 58 * typically used for moving raw data between a peripheral and memory (cf.
59 * string I/O functions), hence the "mem_" prefix. 59 * string I/O functions), hence the "__mem_" prefix.
60 */ 60 */
61#if defined(CONFIG_SWAP_IO_SPACE) 61#if defined(CONFIG_SWAP_IO_SPACE)
62 62
63# define ioswabb(x) (x) 63# define ioswabb(x) (x)
64# define mem_ioswabb(x) (x) 64# define __mem_ioswabb(x) (x)
65# ifdef CONFIG_SGI_IP22 65# ifdef CONFIG_SGI_IP22
66/* 66/*
67 * IP22 seems braindead enough to swap 16bits values in hardware, but 67 * IP22 seems braindead enough to swap 16bits values in hardware, but
68 * not 32bits. Go figure... Can't tell without documentation. 68 * not 32bits. Go figure... Can't tell without documentation.
69 */ 69 */
70# define ioswabw(x) (x) 70# define ioswabw(x) (x)
71# define mem_ioswabw(x) le16_to_cpu(x) 71# define __mem_ioswabw(x) le16_to_cpu(x)
72# else 72# else
73# define ioswabw(x) le16_to_cpu(x) 73# define ioswabw(x) le16_to_cpu(x)
74# define mem_ioswabw(x) (x) 74# define __mem_ioswabw(x) (x)
75# endif 75# endif
76# define ioswabl(x) le32_to_cpu(x) 76# define ioswabl(x) le32_to_cpu(x)
77# define mem_ioswabl(x) (x) 77# define __mem_ioswabl(x) (x)
78# define ioswabq(x) le64_to_cpu(x) 78# define ioswabq(x) le64_to_cpu(x)
79# define mem_ioswabq(x) (x) 79# define __mem_ioswabq(x) (x)
80 80
81#else 81#else
82 82
83# define ioswabb(x) (x) 83# define ioswabb(x) (x)
84# define mem_ioswabb(x) (x) 84# define __mem_ioswabb(x) (x)
85# define ioswabw(x) (x) 85# define ioswabw(x) (x)
86# define mem_ioswabw(x) cpu_to_le16(x) 86# define __mem_ioswabw(x) cpu_to_le16(x)
87# define ioswabl(x) (x) 87# define ioswabl(x) (x)
88# define mem_ioswabl(x) cpu_to_le32(x) 88# define __mem_ioswabl(x) cpu_to_le32(x)
89# define ioswabq(x) (x) 89# define ioswabq(x) (x)
90# define mem_ioswabq(x) cpu_to_le32(x) 90# define __mem_ioswabq(x) cpu_to_le32(x)
91 91
92#endif 92#endif
93 93
@@ -417,7 +417,7 @@ __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
417 \ 417 \
418__BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 418__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
419__BUILD_MEMORY_PFX(, bwlq, type) \ 419__BUILD_MEMORY_PFX(, bwlq, type) \
420__BUILD_MEMORY_PFX(mem_, bwlq, type) \ 420__BUILD_MEMORY_PFX(__mem_, bwlq, type) \
421 421
422BUILDIO_MEM(b, u8) 422BUILDIO_MEM(b, u8)
423BUILDIO_MEM(w, u16) 423BUILDIO_MEM(w, u16)
@@ -430,7 +430,7 @@ BUILDIO_MEM(q, u64)
430 430
431#define BUILDIO_IOPORT(bwlq, type) \ 431#define BUILDIO_IOPORT(bwlq, type) \
432 __BUILD_IOPORT_PFX(, bwlq, type) \ 432 __BUILD_IOPORT_PFX(, bwlq, type) \
433 __BUILD_IOPORT_PFX(mem_, bwlq, type) 433 __BUILD_IOPORT_PFX(__mem_, bwlq, type)
434 434
435BUILDIO_IOPORT(b, u8) 435BUILDIO_IOPORT(b, u8)
436BUILDIO_IOPORT(w, u16) 436BUILDIO_IOPORT(w, u16)
@@ -464,7 +464,7 @@ static inline void writes##bwlq(volatile void __iomem *mem, \
464 const volatile type *__addr = addr; \ 464 const volatile type *__addr = addr; \
465 \ 465 \
466 while (count--) { \ 466 while (count--) { \
467 mem_write##bwlq(*__addr, mem); \ 467 __mem_write##bwlq(*__addr, mem); \
468 __addr++; \ 468 __addr++; \
469 } \ 469 } \
470} \ 470} \
@@ -475,7 +475,7 @@ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
475 volatile type *__addr = addr; \ 475 volatile type *__addr = addr; \
476 \ 476 \
477 while (count--) { \ 477 while (count--) { \
478 *__addr = mem_read##bwlq(mem); \ 478 *__addr = __mem_read##bwlq(mem); \
479 __addr++; \ 479 __addr++; \
480 } \ 480 } \
481} 481}
@@ -488,7 +488,7 @@ static inline void outs##bwlq(unsigned long port, const void *addr, \
488 const volatile type *__addr = addr; \ 488 const volatile type *__addr = addr; \
489 \ 489 \
490 while (count--) { \ 490 while (count--) { \
491 mem_out##bwlq(*__addr, port); \ 491 __mem_out##bwlq(*__addr, port); \
492 __addr++; \ 492 __addr++; \
493 } \ 493 } \
494} \ 494} \
@@ -499,7 +499,7 @@ static inline void ins##bwlq(unsigned long port, void *addr, \
499 volatile type *__addr = addr; \ 499 volatile type *__addr = addr; \
500 \ 500 \
501 while (count--) { \ 501 while (count--) { \
502 *__addr = mem_in##bwlq(port); \ 502 *__addr = __mem_in##bwlq(port); \
503 __addr++; \ 503 __addr++; \
504 } \ 504 } \
505} 505}
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index accb80c9a339..aacaabd28ac1 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -126,6 +126,11 @@ static inline void __user *compat_ptr(compat_uptr_t uptr)
126 return (void __user *)(unsigned long)uptr; 126 return (void __user *)(unsigned long)uptr;
127} 127}
128 128
129static inline compat_uptr_t ptr_to_compat(void __user *uptr)
130{
131 return (u32)(unsigned long)uptr;
132}
133
129static inline void __user *compat_alloc_user_space(long len) 134static inline void __user *compat_alloc_user_space(long len)
130{ 135{
131 struct pt_regs *regs = current->thread.regs; 136 struct pt_regs *regs = current->thread.regs;
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index 67cdaf3ae9fc..c044ec16a879 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -37,7 +37,7 @@ struct thread_info {
37 int preempt_count; /* 0 => preemptable, 37 int preempt_count; /* 0 => preemptable,
38 <0 => BUG */ 38 <0 => BUG */
39 struct restart_block restart_block; 39 struct restart_block restart_block;
40 void *nvgprs_frame; 40 void __user *nvgprs_frame;
41 /* low level flags - has atomic operations done on it */ 41 /* low level flags - has atomic operations done on it */
42 unsigned long flags ____cacheline_aligned_in_smp; 42 unsigned long flags ____cacheline_aligned_in_smp;
43}; 43};
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index be104f21c70a..0b7c0ca4c3d7 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -61,7 +61,7 @@
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 61#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 62
63 63
64static inline int __access_ok(const void *addr, unsigned long size) 64static inline int __access_ok(const void __user *addr, unsigned long size)
65{ 65{
66 return 1; 66 return 1;
67} 67}
@@ -208,25 +208,25 @@ extern int __put_user_bad(void) __attribute__((noreturn));
208 case 1: { \ 208 case 1: { \
209 unsigned char __x; \ 209 unsigned char __x; \
210 __get_user_asm(__x, ptr, __gu_err); \ 210 __get_user_asm(__x, ptr, __gu_err); \
211 (x) = *(__typeof__(*(ptr)) *) &__x; \ 211 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
212 break; \ 212 break; \
213 }; \ 213 }; \
214 case 2: { \ 214 case 2: { \
215 unsigned short __x; \ 215 unsigned short __x; \
216 __get_user_asm(__x, ptr, __gu_err); \ 216 __get_user_asm(__x, ptr, __gu_err); \
217 (x) = *(__typeof__(*(ptr)) *) &__x; \ 217 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
218 break; \ 218 break; \
219 }; \ 219 }; \
220 case 4: { \ 220 case 4: { \
221 unsigned int __x; \ 221 unsigned int __x; \
222 __get_user_asm(__x, ptr, __gu_err); \ 222 __get_user_asm(__x, ptr, __gu_err); \
223 (x) = *(__typeof__(*(ptr)) *) &__x; \ 223 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
224 break; \ 224 break; \
225 }; \ 225 }; \
226 case 8: { \ 226 case 8: { \
227 unsigned long long __x; \ 227 unsigned long long __x; \
228 __get_user_asm(__x, ptr, __gu_err); \ 228 __get_user_asm(__x, ptr, __gu_err); \
229 (x) = *(__typeof__(*(ptr)) *) &__x; \ 229 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
230 break; \ 230 break; \
231 }; \ 231 }; \
232 default: \ 232 default: \
diff --git a/include/linux/ioc3.h b/include/linux/ioc3.h
index e7906a72a4f1..da7c09e4ede6 100644
--- a/include/linux/ioc3.h
+++ b/include/linux/ioc3.h
@@ -27,7 +27,7 @@ struct ioc3_driver_data {
27 int id; /* IOC3 sequence number */ 27 int id; /* IOC3 sequence number */
28 /* PCI mapping */ 28 /* PCI mapping */
29 unsigned long pma; /* physical address */ 29 unsigned long pma; /* physical address */
30 struct __iomem ioc3 *vma; /* pointer to registers */ 30 struct ioc3 __iomem *vma; /* pointer to registers */
31 struct pci_dev *pdev; /* PCI device */ 31 struct pci_dev *pdev; /* PCI device */
32 /* IRQ stuff */ 32 /* IRQ stuff */
33 int dual_irq; /* set if separate IRQs are used */ 33 int dual_irq; /* set if separate IRQs are used */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b23be44cbea8..5208b12d5550 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -549,7 +549,7 @@ struct v4l2_framebuffer
549struct v4l2_clip 549struct v4l2_clip
550{ 550{
551 struct v4l2_rect c; 551 struct v4l2_rect c;
552 struct v4l2_clip *next; 552 struct v4l2_clip __user *next;
553}; 553};
554 554
555struct v4l2_window 555struct v4l2_window