Date: Sun, 22 Jun 2014 08:32:31 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r267714 - stable/10/sys/i386/i386 Message-ID: <201406220832.s5M8WV4k012038@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun Jun 22 08:32:31 2014 New Revision: 267714 URL: http://svnweb.freebsd.org/changeset/base/267714 Log: MFC r267492: Fix some cosmetic issues with the use of kmem_malloc() in the i386 LDT sysarch(2) code. Modified: stable/10/sys/i386/i386/sys_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/sys_machdep.c ============================================================================== --- stable/10/sys/i386/i386/sys_machdep.c Sun Jun 22 08:30:43 2014 (r267713) +++ stable/10/sys/i386/i386/sys_machdep.c Sun Jun 22 08:32:31 2014 (r267714) @@ -164,19 +164,14 @@ sysarch(td, uap) break; case I386_SET_LDT: if (kargs.largs.descs != NULL) { - lp = (union descriptor *)kmem_malloc(kernel_arena, + lp = (union descriptor *)malloc( kargs.largs.num * sizeof(union descriptor), - M_WAITOK); - if (lp == NULL) { - error = ENOMEM; - break; - } + M_TEMP, M_WAITOK); error = copyin(kargs.largs.descs, lp, kargs.largs.num * sizeof(union descriptor)); if (error == 0) error = i386_set_ldt(td, &kargs.largs, lp); - kmem_free(kernel_arena, (vm_offset_t)lp, - kargs.largs.num * sizeof(union descriptor)); + free(lp, M_TEMP); } else { error = i386_set_ldt(td, &kargs.largs, NULL); } @@ -300,10 +295,7 @@ i386_extend_pcb(struct thread *td) }; ext = (struct pcb_ext *)kmem_malloc(kernel_arena, ctob(IOPAGES+1), - M_WAITOK); - if (ext == 0) - return (ENOMEM); - bzero(ext, sizeof(struct pcb_ext)); + M_WAITOK | M_ZERO); /* -16 is so we can convert a trapframe into vm86trapframe inplace */ ext->ext_tss.tss_esp0 = td->td_kstack + ctob(KSTACK_PAGES) - sizeof(struct pcb) - 16; @@ -474,12 +466,7 @@ user_ldt_alloc(struct mdproc *mdp, int l new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_arena, - round_page(len * sizeof(union descriptor)), M_WAITOK); - if (new_ldt->ldt_base == NULL) { - free(new_ldt, M_SUBPROC); - mtx_lock_spin(&dt_lock); - return (NULL); - } + round_page(len * sizeof(union descriptor)), M_WAITOK); new_ldt->ldt_refcnt = 1; new_ldt->ldt_active = 0; @@ -514,12 +501,7 @@ user_ldt_alloc(struct mdproc *mdp, int l new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_arena, - len * sizeof(union descriptor), M_WAITOK); - if (new_ldt->ldt_base == NULL) { - free(new_ldt, M_SUBPROC); - mtx_lock_spin(&dt_lock); - return (NULL); - } + len * sizeof(union descriptor), M_WAITOK); new_ldt->ldt_refcnt = 1; new_ldt->ldt_active = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406220832.s5M8WV4k012038>