Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Ensure the restartable atomic sequence is in userla...
details: https://anonhg.NetBSD.org/src/rev/ccb36b077677
branches: trunk
changeset: 346214:ccb36b077677
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Jul 01 12:49:22 2016 +0000
description:
Ensure the restartable atomic sequence is in userland, for real.
diffstat:
sys/kern/kern_ras.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
diffs (65 lines):
diff -r f1a0e8582aae -r ccb36b077677 sys/kern/kern_ras.c
--- a/sys/kern/kern_ras.c Fri Jul 01 12:41:28 2016 +0000
+++ b/sys/kern/kern_ras.c Fri Jul 01 12:49:22 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ras.c,v 1.36 2013/09/14 20:46:27 martin Exp $ */
+/* $NetBSD: kern_ras.c,v 1.37 2016/07/01 12:49:22 maxv Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.36 2013/09/14 20:46:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.37 2016/07/01 12:49:22 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -197,18 +197,19 @@
int nras, error;
proc_t *p;
+ if (len == 0)
+ return EINVAL;
+
endaddr = (char *)addr + len;
- /* do not warn about < NULL pointer comparision */
+ /* Do not warn about < NULL pointer comparison */
__WARNING_PUSH_LESS_NULL_PTR
- if (addr < (void *)VM_MIN_ADDRESS ||
- endaddr > (void *)VM_MAXUSER_ADDRESS)
- return (EINVAL);
+ if (addr < (void *)VM_MIN_ADDRESS || addr > (void *)VM_MAXUSER_ADDRESS)
+ return EINVAL;
+ if (endaddr < addr)
+ return EINVAL;
__WARNING_POP_LESS_NULL_PTR
- if (len <= 0)
- return (EINVAL);
-
newrp = kmem_alloc(sizeof(*newrp), KM_SLEEP);
newrp->ras_startaddr = addr;
newrp->ras_endaddr = endaddr;
@@ -278,7 +279,6 @@
int
sys_rasctl(struct lwp *l, const struct sys_rasctl_args *uap, register_t *retval)
{
-
#if defined(__HAVE_RAS)
/* {
syscallarg(void *) addr;
@@ -317,11 +317,7 @@
}
return (error);
-
#else
-
return (EOPNOTSUPP);
-
#endif
-
}
Home |
Main Index |
Thread Index |
Old Index