X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..eee3565979933af707c711411001ba11fe406a3c:/bsd/security/audit/audit_pipe.c?ds=sidebyside diff --git a/bsd/security/audit/audit_pipe.c b/bsd/security/audit/audit_pipe.c index 9f64bba84..f2efbbe08 100644 --- a/bsd/security/audit/audit_pipe.c +++ b/bsd/security/audit/audit_pipe.c @@ -571,7 +571,7 @@ audit_pipe_alloc(void) AUDIT_PIPE_LIST_WLOCK_ASSERT(); - ap = malloc(sizeof(*ap), M_AUDIT_PIPE, M_NOWAIT | M_ZERO); + ap = malloc(sizeof(*ap), M_AUDIT_PIPE, M_WAITOK | M_ZERO); if (ap == NULL) return (NULL); @@ -646,6 +646,7 @@ audit_pipe_free(struct audit_pipe *ap) audit_pipe_flush(ap); cv_destroy(&ap->ap_cv); AUDIT_PIPE_SX_LOCK_DESTROY(ap); + AUDIT_PIPE_UNLOCK(ap); AUDIT_PIPE_LOCK_DESTROY(ap); #ifndef __APPLE__ knlist_destroy(&ap->ap_selinfo.si_note); @@ -1006,7 +1007,7 @@ audit_pipe_read(dev_t dev, struct uio *uio, __unused int flag) KASSERT(ape->ape_record_len > ap->ap_qoffset, ("audit_pipe_read: record_len > qoffset (1)")); - toread = MIN(ape->ape_record_len - ap->ap_qoffset, + toread = MIN((int)(ape->ape_record_len - ap->ap_qoffset), uio_resid(uio)); AUDIT_PIPE_UNLOCK(ap); error = uiomove((char *)ape->ape_record + ap->ap_qoffset,