From owner-freebsd-bugs Sun Sep 17 10:50: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2322E37B42C for ; Sun, 17 Sep 2000 10:50:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA24867; Sun, 17 Sep 2000 10:50:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Sun, 17 Sep 2000 10:50:02 -0700 (PDT) Message-Id: <200009171750.KAA24867@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jonathan Chen Subject: Re: i386/21329: change to allow vm86 interrupt calls from userland Reply-To: Jonathan Chen Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR i386/21329; it has been noted by GNATS. From: Jonathan Chen To: Bill Fumerola Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: i386/21329: change to allow vm86 interrupt calls from userland Date: Sun, 17 Sep 2000 13:41:10 -0400 On Sun, Sep 17, 2000 at 01:31:14PM -0400, Bill Fumerola wrote: > just a little style police.. > > > + if ((error = copyin(ua.sub_args, &sa, sizeof(sa)))) > > Gratuitous parens. Optionally, add an explicit check here (ie, != 0 or something) > in which case the parens actually make sense. Yes, I'm aware of what style() says, but gcc -Wall, in its brokenness, "suggests parentheses around assignment used as truth value". I have no clue why gcc would think extra parentheses would be cool there, but I decided to silence gcc instead of following style() (and didn't think of the != 0 bit). Anyway, this should be better: Index: sys/i386/i386/vm86.c =================================================================== RCS file: /export/ncvs/src/sys/i386/i386/vm86.c,v retrieving revision 1.31 diff -u -r1.31 vm86.c --- sys/i386/i386/vm86.c 1999/10/29 18:08:35 1.31 +++ sys/i386/i386/vm86.c 2000/09/17 17:37:08 @@ -701,18 +701,18 @@ } break; -#if 0 case VM86_INTCALL: { struct vm86_intcall_args sa; - if (error = copyin(ua.sub_args, &sa, sizeof(sa))) + if (p->p_cred->pc_ucred->cr_uid != 0) return EPERM; + + if (0 != (error = copyin(ua.sub_args, &sa, sizeof(sa)))) return (error); - if (error = vm86_intcall(sa.intnum, &sa.vmf)) + if (0 != (error = vm86_intcall(sa.intnum, &sa.vmf))) return (error); error = copyout(&sa, ua.sub_args, sizeof(sa)); } break; -#endif default: error = EINVAL; -- (o_ 1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2 _o) \\\_\ Jonathan Chen jon@spock.org /_/// <____) No electrons were harmed during production of this message (____> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message