svn commit: r217817 - stable/8/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Tue Jan 25 10:17:38 UTC 2011


Author: kib
Date: Tue Jan 25 10:17:37 2011
New Revision: 217817
URL: http://svn.freebsd.org/changeset/base/217817

Log:
  MFC r217563:
  Use malloc(9) instead of kmem_alloc(9) for temporal copy of the
  user-supplied descriptor array.

Modified:
  stable/8/sys/amd64/amd64/sys_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/sys_machdep.c	Tue Jan 25 10:14:12 2011	(r217816)
+++ stable/8/sys/amd64/amd64/sys_machdep.c	Tue Jan 25 10:17:37 2011	(r217817)
@@ -105,19 +105,13 @@ sysarch_ldt(struct thread *td, struct sy
 	case I386_SET_LDT:
 		td->td_pcb->pcb_full_iret = 1;
 		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);
 		}


More information about the svn-src-all mailing list