From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 18:48:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A7BD1106564A for ; Fri, 29 Jun 2012 18:48:06 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 18:48:06 +0000 Date: Fri, 29 Jun 2012 18:48:06 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629184806.A7BD1106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238595 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 18:48:07 -0000 Author: gmiller Date: Fri Jun 29 18:48:03 2012 New Revision: 238595 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238595 Log: r238577@FreeBSD-dev: root | 2012-06-20 08:44:55 -0500 Fix NULL-pointer issues in graph insertion. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/lists.c Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Fri Jun 29 17:39:40 2012 (r238594) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Fri Jun 29 18:48:03 2012 (r238595) @@ -73,9 +73,12 @@ static struct graph_node * lookup_node(void *lock) { - struct graph_node *node; + struct graph_node *node = NULL; + + if (root != NULL) { + node = scan_graph(root, lock); + } - node = scan_graph(root, lock); if (node == NULL) { node = malloc(sizeof(struct graph_node)); node->lock = lock; Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Fri Jun 29 17:39:40 2012 (r238594) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Fri Jun 29 18:48:03 2012 (r238595) @@ -27,7 +27,7 @@ #include "witness.h" -_Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = +static _Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = SLIST_HEAD_INITIALIZER(lock_head); // XXX: temporary debugging code @@ -56,8 +56,8 @@ SLIST_INSERT_HEAD(&lock_head, entry, lock_next); - if (insert_lock(entry, next) < 0) { - /* XXX: LoR */ + if (next != NULL && insert_lock(entry, next) < 0) { + puts("LoR detected."); } printf("inserted lock %p\n", lock); @@ -74,6 +74,7 @@ if (entry->lock == lock) { SLIST_REMOVE(&lock_head, entry, lock_entry, lock_next); free(entry); + break; } }