From owner-freebsd-bugs Sun Sep 17 10:50: 7 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 2FE8237B43C for ; Sun, 17 Sep 2000 10:50:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA24874; Sun, 17 Sep 2000 10:50:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Sun, 17 Sep 2000 10:50:03 -0700 (PDT) Message-Id: <200009171750.KAA24874@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bill Fumerola Subject: Re: i386/21329: change to allow vm86 interrupt calls from userland Reply-To: Bill Fumerola 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: Bill Fumerola To: Jonathan Chen Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: i386/21329: change to allow vm86 interrupt calls from userland Date: Sun, 17 Sep 2000 13:43:43 -0400 On Sun, Sep 17, 2000 at 01:41:10PM -0400, Jonathan Chen wrote: > 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: I think it's gcc's roundabout way of encouraging the practice of explicit checks. This makes even more sense when you get into things returning NULL and abusing the if(!something_that_might_be_null) case. > [...] > - 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 #1. You still need the \nreturn EPERM; #2. I'd put the != 0 after the call. -- Bill Fumerola - Network Architect, BOFH / Chimes, Inc. billf@chimesnet.com / billf@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message