PERFORCE change 40803 for review
Robert Watson
rwatson at FreeBSD.org
Thu Oct 30 05:23:41 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=40803
Change 40803 by rwatson at rwatson_paprika on 2003/10/29 21:23:38
M_WAITOK doesn't fail with normal kernel malloc().
Pointed out by: rishi
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/kern/uipc_sem.c#15 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/kern/uipc_sem.c#15 (text+ko) ====
@@ -226,8 +226,7 @@
/* XXX Use p31b_getcfg(CTL_P1003_1B_SEM_VALUE_MAX) instead? */
if (value > SEM_VALUE_MAX)
return (EINVAL);
- if( (ret = malloc(sizeof(*ret), M_SEM, M_WAITOK | M_ZERO)) == NULL)
- return (ENOMEM);
+ ret = malloc(sizeof(*ret), M_SEM, M_WAITOK | M_ZERO);
if (name != NULL) {
len = strlen(name);
if (len > SEM_MAX_NAMELEN) {
@@ -239,10 +238,7 @@
free(ret, M_SEM);
return (EINVAL);
}
- if( (ret->ks_name = malloc(len + 1, M_SEM, M_WAITOK)) == NULL){
- free(ret, M_SEM);
- return (ENOMEM);
- }
+ ret->ks_name = malloc(len + 1, M_SEM, M_WAITOK);
strcpy(ret->ks_name, name);
} else {
ret->ks_name = NULL;
@@ -597,8 +593,7 @@
mtx_assert(&sem_lock, MA_NOTOWNED);
mtx_assert(&ks->ks_mtx, MA_NOTOWNED);
- if( (ku = malloc(sizeof(*ku), M_SEM, M_WAITOK | M_ZERO)) == NULL)
- return;
+ ku = malloc(sizeof(*ku), M_SEM, M_WAITOK | M_ZERO);
ku->ku_pid = p->p_pid;
mtx_lock(&sem_lock);
k = sem_getuser(p, ks);
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