Source-Changes-HG archive

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

[src/trunk]: src/sys/kern add missing systrace_{un, }lock in systrace_poll. r...



details:   https://anonhg.NetBSD.org/src/rev/58048181c5f8
branches:  trunk
changeset: 534191:58048181c5f8
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jul 19 23:55:01 2002 +0000

description:
add missing systrace_{un,}lock in systrace_poll.  reported to provos.

don't use MALLOC() with variable size.  from openbsd.

diffstat:

 sys/kern/kern_systrace.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 5d8a275c2620 -r 58048181c5f8 sys/kern/kern_systrace.c
--- a/sys/kern/kern_systrace.c  Fri Jul 19 22:03:39 2002 +0000
+++ b/sys/kern/kern_systrace.c  Fri Jul 19 23:55:01 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_systrace.c,v 1.7 2002/07/16 19:53:37 christos Exp $       */
+/*     $NetBSD: kern_systrace.c,v 1.8 2002/07/19 23:55:01 itojun Exp $ */
 
 /*
  * Copyright 2002 Niels Provos <provos%citi.umich.edu@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.7 2002/07/16 19:53:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.8 2002/07/19 23:55:01 itojun Exp $");
 
 #include "opt_systrace.h"
 
@@ -395,7 +395,9 @@
        if ((events & (POLLIN | POLLRDNORM)) == 0)
                return (revents);
 
+       systrace_lock();
        SYSTRACE_LOCK(fst, p);
+       systrace_unlock();
        if (TAILQ_EMPTY(&fst->messages) == 0)
                revents |= events & (POLLIN | POLLRDNORM);
        else
@@ -1137,7 +1139,7 @@
        fst->npolicies--;
 
        if (policy->nsysent)
-               FREE(policy->sysent, M_XDATA);
+               free(policy->sysent, M_XDATA);
 
        TAILQ_REMOVE(&fst->policies, policy, next);
 
@@ -1186,7 +1188,7 @@
 
        memset((caddr_t)pol, 0, sizeof(struct str_policy));
 
-       MALLOC(pol->sysent, u_char *, maxents * sizeof(u_char),
+       pol->sysent = (u_char *)malloc(maxents * sizeof(u_char),
            M_XDATA, M_WAITOK);
        pol->nsysent = maxents;
        for (i = 0; i < maxents; i++)



Home | Main Index | Thread Index | Old Index