diff options
-rw-r--r-- | sys/arch/mips64/mips64/cpu.c | 14 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/mem.c | 11 |
2 files changed, 14 insertions, 11 deletions
diff --git a/sys/arch/mips64/mips64/cpu.c b/sys/arch/mips64/mips64/cpu.c index fd9b14d1cd4..ee6322991c6 100644 --- a/sys/arch/mips64/mips64/cpu.c +++ b/sys/arch/mips64/mips64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.49 2012/10/03 11:18:23 miod Exp $ */ +/* $OpenBSD: cpu.c,v 1.50 2013/05/09 19:45:19 miod Exp $ */ /* * Copyright (c) 1997-2004 Opsycon AB (www.opsycon.se) @@ -86,11 +86,13 @@ cpuattach(struct device *parent, struct device *dev, void *aux) #ifdef MULTIPROCESSOR ci->ci_flags |= CPUF_RUNNING | CPUF_PRESENT | CPUF_PRIMARY; cpuset_add(&cpus_running, ci); - cpu_info_secondaries = (struct cpu_info *) - alloc_contiguous_pages(sizeof(struct cpu_info) * - (ncpusfound - 1)); - if (cpu_info_secondaries == NULL) - panic("unable to allocate cpu_info"); + if (ncpusfound > 1) { + cpu_info_secondaries = (struct cpu_info *) + alloc_contiguous_pages(sizeof(struct cpu_info) * + (ncpusfound - 1)); + if (cpu_info_secondaries == NULL) + panic("unable to allocate cpu_info"); + } #endif } #ifdef MULTIPROCESSOR diff --git a/sys/arch/mips64/mips64/mem.c b/sys/arch/mips64/mips64/mem.c index 3de987bc7c8..885f392c626 100644 --- a/sys/arch/mips64/mips64/mem.c +++ b/sys/arch/mips64/mips64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.17 2011/05/01 07:01:37 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.18 2013/05/09 19:45:19 miod Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -97,7 +97,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) { struct iovec *iov; boolean_t allowed; - int error = 0, c; + int error = 0; + size_t c; vaddr_t v; while (uio->uio_resid > 0 && error == 0) { @@ -115,7 +116,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) case 0: v = uio->uio_offset; c = iov->iov_len; - if (v + c > ptoa((psize_t)physmem)) + if (v + c < v || v + c > ptoa((psize_t)physmem)) return (EFAULT); v = (vaddr_t)PHYS_TO_XKPHYS(v, CCA_NONCOHERENT); error = uiomove((caddr_t)v, c, uio); @@ -124,7 +125,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); /* Allow access to RAM through XKPHYS... */ if (IS_XKPHYS(v)) @@ -167,7 +168,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); + c = ulmin(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; |