From owner-svn-src-head@freebsd.org Thu Oct 5 18:42:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC90EE3F5FF; Thu, 5 Oct 2017 18:42:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 889728104D; Thu, 5 Oct 2017 18:42:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v95IgDN5001994; Thu, 5 Oct 2017 18:42:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v95IgDC4001993; Thu, 5 Oct 2017 18:42:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201710051842.v95IgDC4001993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 5 Oct 2017 18:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324326 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 324326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 18:42:14 -0000 Author: kib Date: Thu Oct 5 18:42:13 2017 New Revision: 324326 URL: https://svnweb.freebsd.org/changeset/base/324326 Log: Style. Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/sys_machdep.c Modified: head/sys/i386/i386/sys_machdep.c ============================================================================== --- head/sys/i386/i386/sys_machdep.c Thu Oct 5 18:38:42 2017 (r324325) +++ head/sys/i386/i386/sys_machdep.c Thu Oct 5 18:42:13 2017 (r324326) @@ -166,7 +166,7 @@ sysarch(struct thread *td, struct sysarch_args *uap) break; } - switch(uap->op) { + switch (uap->op) { case I386_GET_LDT: error = i386_get_ldt(td, &kargs.largs); break; @@ -432,8 +432,7 @@ user_ldt_alloc(struct mdproc *mdp, int len) mtx_assert(&dt_lock, MA_OWNED); mtx_unlock_spin(&dt_lock); - new_ldt = malloc(sizeof(struct proc_ldt), - M_SUBPROC, M_WAITOK); + new_ldt = malloc(sizeof(struct proc_ldt), M_SUBPROC, M_WAITOK); new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_arena, @@ -463,10 +462,11 @@ user_ldt_alloc(struct mdproc *mdp, int len) void user_ldt_free(struct thread *td) { - struct mdproc *mdp = &td->td_proc->p_md; + struct mdproc *mdp; struct proc_ldt *pldt; mtx_assert(&dt_lock, MA_OWNED); + mdp = &td->td_proc->p_md; if ((pldt = mdp->md_ldt) == NULL) { mtx_unlock_spin(&dt_lock); return; @@ -587,12 +587,11 @@ i386_set_ldt(td, uap, descs) return (0); } - if (!(uap->start == LDT_AUTO_ALLOC && uap->num == 1)) { + if (uap->start != LDT_AUTO_ALLOC || uap->num != 1) { /* verify range of descriptors to modify */ largest_ld = uap->start + uap->num; - if (uap->start >= MAX_LD || largest_ld > MAX_LD) { + if (uap->start >= MAX_LD || largest_ld > MAX_LD) return (EINVAL); - } } /* Check descriptors for access violations */ @@ -618,12 +617,7 @@ i386_set_ldt(td, uap, descs) case SDT_SYS386TGT: /* system 386 trap gate */ case SDT_SYS286CGT: /* system 286 call gate */ case SDT_SYS386CGT: /* system 386 call gate */ - /* I can't think of any reason to allow a user proc - * to create a segment of these types. They are - * for OS use only. - */ return (EACCES); - /*NOTREACHED*/ /* memory segment types */ case SDT_MEMEC: /* memory execute only conforming */ @@ -648,12 +642,11 @@ i386_set_ldt(td, uap, descs) case SDT_MEMERA: /* memory execute read accessed */ break; default: - return(EINVAL); - /*NOTREACHED*/ + return (EINVAL); } /* Only user (ring-3) descriptors may be present. */ - if ((dp->sd.sd_p != 0) && (dp->sd.sd_dpl != SEL_UPL)) + if (dp->sd.sd_p != 0 && dp->sd.sd_dpl != SEL_UPL) return (EACCES); }