From owner-p4-projects@FreeBSD.ORG Thu Dec 1 00:45:45 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A850916A42B; Thu, 1 Dec 2005 00:45:44 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4BFDE16A427 for ; Thu, 1 Dec 2005 00:45:44 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D916143D58 for ; Thu, 1 Dec 2005 00:45:43 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jB10jhqo082247 for ; Thu, 1 Dec 2005 00:45:43 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jB10jgPn082244 for perforce@freebsd.org; Thu, 1 Dec 2005 00:45:42 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 1 Dec 2005 00:45:42 GMT Message-Id: <200512010045.jB10jgPn082244@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 87557 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2005 00:45:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=87557 Change 87557 by rwatson@rwatson_peppercorn on 2005/12/01 00:45:14 Minor style tweaks. Annotate a race in the initialization of the mask code. Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_mask.c#6 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_mask.c#6 (text+ko) ==== @@ -42,11 +42,14 @@ * XXX ev_cache, once created, sticks around until the calling program exits. * This may or may not be a problem as far as absolute memory usage goes, but * at least there don't appear to be any leaks in using the cache. + * + * XXXRW: Note that despite (mutex), load_event_table() could race with + * other consumers of the getauevents() API. */ static LIST_HEAD(, audit_event_map) ev_cache; static int -load_event_table(VOID) +load_event_table(void) { struct au_event_ent *ev; struct audit_event_map *elem; @@ -64,7 +67,7 @@ /* Enumerate the events. */ while ((ev = getauevent()) != NULL) { - elem = malloc (sizeof (struct audit_event_map)); + elem = malloc(sizeof(struct audit_event_map)); if (elem == NULL) { free_au_event_ent(ev); pthread_mutex_unlock(&mutex); @@ -126,7 +129,7 @@ LIST_FOREACH(elem, &ev_cache, ev_list) { if (elem->ev->ae_number == event) { pthread_mutex_unlock(&mutex); - return elem->ev; + return (elem->ev); } } pthread_mutex_unlock(&mutex);