Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 Allocate directly KQ_NEVENTS bytes. Othe...



details:   https://anonhg.NetBSD.org/src/rev/425bd21c531a
branches:  trunk
changeset: 330143:425bd21c531a
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jun 24 14:33:57 2014 +0000

description:
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.

ok christos@

diffstat:

 sys/compat/netbsd32/netbsd32_compat_50.c |  7 ++++---
 sys/compat/netbsd32/netbsd32_event.c     |  7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r e2a09668a4f9 -r 425bd21c531a sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c  Tue Jun 24 12:54:56 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c  Tue Jun 24 14:33:57 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_50.c,v 1.23 2013/03/29 01:04:30 christos Exp $ */
+/*     $NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.23 2013/03/29 01:04:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -633,7 +633,8 @@
 
        nchanges = SCARG(uap, nchanges);
        nevents = SCARG(uap, nevents);
-       maxalloc = MIN(KQ_NEVENTS, MAX(nchanges, nevents));
+       maxalloc = KQ_NEVENTS;
+
        netbsd32_kevent_ops.keo_private =
            kmem_alloc(maxalloc * sizeof(struct netbsd32_kevent), KM_SLEEP);
 
diff -r e2a09668a4f9 -r 425bd21c531a sys/compat/netbsd32/netbsd32_event.c
--- a/sys/compat/netbsd32/netbsd32_event.c      Tue Jun 24 12:54:56 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_event.c      Tue Jun 24 14:33:57 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_event.c,v 1.10 2014/01/23 10:50:14 manu Exp $ */
+/*     $NetBSD: netbsd32_event.c,v 1.11 2014/06/24 14:33:57 maxv Exp $ */
 
 /*
  *  Copyright (c) 2005 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_event.c,v 1.10 2014/01/23 10:50:14 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_event.c,v 1.11 2014/06/24 14:33:57 maxv Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -112,7 +112,8 @@
 
        nchanges = SCARG(uap, nchanges);
        nevents = SCARG(uap, nevents);
-       maxalloc = MIN(KQ_NEVENTS, MAX(nchanges, nevents));
+       maxalloc = KQ_NEVENTS;
+
        netbsd32_kevent_ops.keo_private =
            kmem_alloc(maxalloc * sizeof(struct netbsd32_kevent), KM_SLEEP);
 



Home | Main Index | Thread Index | Old Index