Date: Fri, 23 Feb 2007 16:38:44 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 114873 for review Message-ID: <200702231638.l1NGcimm031684@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114873 Change 114873 by millert@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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702231638.l1NGcimm031684>