PERFORCE change 114873 for review

Todd Miller millert at FreeBSD.org
Fri Feb 23 16:38:45 UTC 2007


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

Change 114873 by millert at millert_macbook on 2007/02/23 16:38:38

	Check for NULL return from labelh_new() when called with
	canblock == 0.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#13 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#13 (text+ko) ====

@@ -118,6 +118,8 @@
 	ipc_labelh_t lh;
 
 	lh = (ipc_labelh_t)zalloc_canblock(ipc_labelh_zone, canblock);
+	if (lh == NULL)
+		return (NULL);
 	lh_lock_init(lh);
 	lh->lh_port = ipc_port_alloc_kernel();
 	lh->lh_type = LABELH_TYPE_KERN;
@@ -137,10 +139,12 @@
 	ipc_labelh_t lh;
 
 	lh = labelh_new(0);
-	ip_lock(lh->lh_port);
-	mac_task_label_init(&lh->lh_label);
-	mac_task_label_copy(&old->lh_label, &lh->lh_label);
-	ip_unlock(lh->lh_port);
+	if (lh != NULL) {
+		ip_lock(lh->lh_port);
+		mac_task_label_init(&lh->lh_label);
+		mac_task_label_copy(&old->lh_label, &lh->lh_label);
+		ip_unlock(lh->lh_port);
+	}
 	return (lh);
 }
 


More information about the p4-projects mailing list