PERFORCE change 87557 for review

Robert Watson rwatson at FreeBSD.org
Thu Dec 1 00:45:42 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=87557

Change 87557 by rwatson at 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);
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list