]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/kern_authorization.c
xnu-7195.81.3.tar.gz
[apple/xnu.git] / bsd / kern / kern_authorization.c
index 574d4b1988bc9cd29465dd7ee934e156df5775a5..0181ee93de8d2c4a120183cacb21675835dad8e4 100644 (file)
@@ -983,7 +983,7 @@ kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp)
 {
        int error;
        kauth_filesec_t fsec;
-       u_int32_t count;
+       size_t count;
        size_t copysize;
 
        error = 0;
@@ -1006,14 +1006,14 @@ kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp)
         */
        {
                user_addr_t known_bound = (xsecurity & PAGE_MASK) + KAUTH_FILESEC_SIZE(0);
-               user_addr_t uaddr = mach_vm_round_page(known_bound);
+               user_addr_t uaddr = (user_addr_t)mach_vm_round_page(known_bound);
                count = (uaddr - known_bound) / sizeof(struct kauth_ace);
        }
        if (count > 32) {
                count = 32;
        }
 restart:
-       if ((fsec = kauth_filesec_alloc(count)) == NULL) {
+       if ((fsec = kauth_filesec_alloc((int)count)) == NULL) {
                error = ENOMEM;
                goto out;
        }
@@ -1217,7 +1217,11 @@ kauth_acl_alloc(int count)
 void
 kauth_acl_free(kauth_acl_t aclp)
 {
-       FREE(aclp, M_KAUTH);
+       /*
+        * It's possible this may have have been allocated in a kext using
+        * MALLOC. Using KHEAP_ANY will allow us to free it here.
+        */
+       kheap_free_addr(KHEAP_ANY, aclp);
 }