Date: Wed, 16 Aug 2006 18:42:12 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 104271 for review Message-ID: <200608161842.k7GIgCsi009214@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104271 Change 104271 by millert@millert_macbook on 2006/08/16 18:41:28 Just treat the return value of mac_check_service_access() as 0 or non-zero instead of trying to interpret BSD errno values (which are not visible here). Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/security.c#2 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/security.c#2 (text+ko) ==== @@ -124,15 +124,7 @@ mac_destroy_task_label(&subjl); mac_destroy_task_label(&objl); - switch (rc) { - case 0: - return KERN_SUCCESS; - case 22: - /* EINVAL */ - return KERN_INVALID_ARGUMENT; - default: - return KERN_NO_ACCESS; - } + return rc ? KERN_NO_ACCESS : KERN_SUCCESS; } kern_return_t @@ -191,15 +183,7 @@ io_unlock (objp); mac_destroy_task_label(&subjl); - switch (rc) { - case 0: - return KERN_SUCCESS; - case 22: - /* EINVAL */ - return KERN_INVALID_ARGUMENT; - default: - return KERN_NO_ACCESS; - } + return rc ? KERN_NO_ACCESS : KERN_SUCCESS; } kern_return_t @@ -248,15 +232,7 @@ io_unlock(objp); ipc_port_multiple_unlock(); - switch (rc) { - case 0: - return KERN_SUCCESS; - case 22: - /* EINVAL */ - return KERN_INVALID_ARGUMENT; - default: - return KERN_NO_ACCESS; - } + return rc ? KERN_NO_ACCESS : KERN_SUCCESS; errout: io_unlocklabel(subp); @@ -314,19 +290,7 @@ io_unlock(objp); ipc_port_multiple_unlock(); - switch (rc) { - case 0: - kr = labelh_new_user(space, &outl, outlabel); - break; - case 22: - /* EINVAL */ - kr = KERN_INVALID_ARGUMENT; - break; - default: - kr = KERN_NO_ACCESS; - break; - } - + kr = rc ? KERN_NO_ACCESS : KERN_SUCCESS; if (kr != KERN_SUCCESS) mac_destroy_port_label(&outl);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608161842.k7GIgCsi009214>