Date: Thu, 1 Dec 2005 00:45:42 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 87557 for review Message-ID: <200512010045.jB10jgPn082244@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512010045.jB10jgPn082244>