diff options
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/ebus.c | 7 | ||||
-rw-r--r-- | arch/sparc/kernel/ioport.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/sys_sparc.c | 37 |
3 files changed, 26 insertions, 20 deletions
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c index 81c0cbd96ff0..75ac24d229b1 100644 --- a/arch/sparc/kernel/ebus.c +++ b/arch/sparc/kernel/ebus.c | |||
@@ -277,7 +277,7 @@ void __init ebus_init(void) | |||
277 | struct pci_dev *pdev; | 277 | struct pci_dev *pdev; |
278 | struct pcidev_cookie *cookie; | 278 | struct pcidev_cookie *cookie; |
279 | struct device_node *dp; | 279 | struct device_node *dp; |
280 | unsigned long addr, *base; | 280 | struct resource *p; |
281 | unsigned short pci_command; | 281 | unsigned short pci_command; |
282 | int len, reg, nreg; | 282 | int len, reg, nreg; |
283 | int num_ebus = 0; | 283 | int num_ebus = 0; |
@@ -321,13 +321,12 @@ void __init ebus_init(void) | |||
321 | } | 321 | } |
322 | nreg = len / sizeof(struct linux_prom_pci_registers); | 322 | nreg = len / sizeof(struct linux_prom_pci_registers); |
323 | 323 | ||
324 | base = &ebus->self->resource[0].start; | 324 | p = &ebus->self->resource[0]; |
325 | for (reg = 0; reg < nreg; reg++) { | 325 | for (reg = 0; reg < nreg; reg++) { |
326 | if (!(regs[reg].which_io & 0x03000000)) | 326 | if (!(regs[reg].which_io & 0x03000000)) |
327 | continue; | 327 | continue; |
328 | 328 | ||
329 | addr = regs[reg].phys_lo; | 329 | (p++)->start = regs[reg].phys_lo; |
330 | *base++ = addr; | ||
331 | } | 330 | } |
332 | 331 | ||
333 | ebus->ofdev.node = dp; | 332 | ebus->ofdev.node = dp; |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 8654b446ac9e..d33f8a07ccac 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -508,6 +508,7 @@ void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *s | |||
508 | 508 | ||
509 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | 509 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) |
510 | { | 510 | { |
511 | #ifndef CONFIG_SUN4 | ||
511 | struct device_node *parent = dp->parent; | 512 | struct device_node *parent = dp->parent; |
512 | 513 | ||
513 | if (sparc_cpu_model != sun4d && | 514 | if (sparc_cpu_model != sun4d && |
@@ -524,6 +525,7 @@ void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | |||
524 | 525 | ||
525 | iounit_init(dp->node, parent->node, sbus); | 526 | iounit_init(dp->node, parent->node, sbus); |
526 | } | 527 | } |
528 | #endif | ||
527 | } | 529 | } |
528 | 530 | ||
529 | void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp) | 531 | void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp) |
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index a41c8a5c2007..896863fb208a 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c | |||
@@ -219,6 +219,21 @@ out: | |||
219 | return err; | 219 | return err; |
220 | } | 220 | } |
221 | 221 | ||
222 | int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) | ||
223 | { | ||
224 | if (ARCH_SUN4C_SUN4 && | ||
225 | (len > 0x20000000 || | ||
226 | ((flags & MAP_FIXED) && | ||
227 | addr < 0xe0000000 && addr + len > 0x20000000))) | ||
228 | return -EINVAL; | ||
229 | |||
230 | /* See asm-sparc/uaccess.h */ | ||
231 | if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) | ||
232 | return -EINVAL; | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
222 | /* Linux version of mmap */ | 237 | /* Linux version of mmap */ |
223 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, | 238 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, |
224 | unsigned long prot, unsigned long flags, unsigned long fd, | 239 | unsigned long prot, unsigned long flags, unsigned long fd, |
@@ -233,25 +248,13 @@ static unsigned long do_mmap2(unsigned long addr, unsigned long len, | |||
233 | goto out; | 248 | goto out; |
234 | } | 249 | } |
235 | 250 | ||
236 | retval = -EINVAL; | ||
237 | len = PAGE_ALIGN(len); | 251 | len = PAGE_ALIGN(len); |
238 | if (ARCH_SUN4C_SUN4 && | ||
239 | (len > 0x20000000 || | ||
240 | ((flags & MAP_FIXED) && | ||
241 | addr < 0xe0000000 && addr + len > 0x20000000))) | ||
242 | goto out_putf; | ||
243 | |||
244 | /* See asm-sparc/uaccess.h */ | ||
245 | if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) | ||
246 | goto out_putf; | ||
247 | |||
248 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 252 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
249 | 253 | ||
250 | down_write(¤t->mm->mmap_sem); | 254 | down_write(¤t->mm->mmap_sem); |
251 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | 255 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); |
252 | up_write(¤t->mm->mmap_sem); | 256 | up_write(¤t->mm->mmap_sem); |
253 | 257 | ||
254 | out_putf: | ||
255 | if (file) | 258 | if (file) |
256 | fput(file); | 259 | fput(file); |
257 | out: | 260 | out: |
@@ -467,19 +470,21 @@ asmlinkage int sys_getdomainname(char __user *name, int len) | |||
467 | { | 470 | { |
468 | int nlen, err; | 471 | int nlen, err; |
469 | 472 | ||
470 | if (len < 0 || len > __NEW_UTS_LEN) | 473 | if (len < 0) |
471 | return -EINVAL; | 474 | return -EINVAL; |
472 | 475 | ||
473 | down_read(&uts_sem); | 476 | down_read(&uts_sem); |
474 | 477 | ||
475 | nlen = strlen(system_utsname.domainname) + 1; | 478 | nlen = strlen(system_utsname.domainname) + 1; |
476 | if (nlen < len) | 479 | err = -EINVAL; |
477 | len = nlen; | 480 | if (nlen > len) |
481 | goto out; | ||
478 | 482 | ||
479 | err = -EFAULT; | 483 | err = -EFAULT; |
480 | if (!copy_to_user(name, system_utsname.domainname, len)) | 484 | if (!copy_to_user(name, system_utsname.domainname, nlen)) |
481 | err = 0; | 485 | err = 0; |
482 | 486 | ||
487 | out: | ||
483 | up_read(&uts_sem); | 488 | up_read(&uts_sem); |
484 | return err; | 489 | return err; |
485 | } | 490 | } |