Author: kib
Date: Tue Jan 18 22:56:10 2011
New Revision: 217563
URL: http://svn.freebsd.org/changeset/base/217563

Log:
  Use malloc(9) instead of kmem_alloc(9) for temporal copy of the
  user-supplied descriptor array.
  
  Noted and reviewed by:        jhb (previous version)
  MFC after:    1 week

Modified:
  head/sys/amd64/amd64/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- head/sys/amd64/amd64/sys_machdep.c  Tue Jan 18 22:19:55 2011        
(r217562)
+++ head/sys/amd64/amd64/sys_machdep.c  Tue Jan 18 22:56:10 2011        
(r217563)
@@ -105,19 +105,13 @@ sysarch_ldt(struct thread *td, struct sy
                        return (EINVAL);
                set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
                if (largs->descs != NULL) {
-                       lp = (struct user_segment_descriptor *)
-                           kmem_alloc(kernel_map, largs->num *
-                           sizeof(struct user_segment_descriptor));
-                       if (lp == NULL) {
-                               error = ENOMEM;
-                               break;
-                       }
+                       lp = malloc(largs->num * sizeof(struct
+                           user_segment_descriptor), M_TEMP, M_WAITOK);
                        error = copyin(largs->descs, lp, largs->num *
                            sizeof(struct user_segment_descriptor));
                        if (error == 0)
                                error = amd64_set_ldt(td, largs, lp);
-                       kmem_free(kernel_map, (vm_offset_t)lp, largs->num *
-                           sizeof(struct user_segment_descriptor));
+                       free(lp, M_TEMP);
                } else {
                        error = amd64_set_ldt(td, largs, NULL);
                }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to