From owner-freebsd-bugs Mon Aug 4 02:50:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA24498 for bugs-outgoing; Mon, 4 Aug 1997 02:50:04 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA24492; Mon, 4 Aug 1997 02:50:02 -0700 (PDT) Resent-Date: Mon, 4 Aug 1997 02:50:02 -0700 (PDT) Resent-Message-Id: <199708040950.CAA24492@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, fpm@n2.net Received: from jsbach.n2.net (jsbach.n2.net [207.113.132.22]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA24291 for ; Mon, 4 Aug 1997 02:43:03 -0700 (PDT) Received: (from fpm@localhost) by jsbach.n2.net (8.8.5/8.6.12) id CAA17905; Mon, 4 Aug 1997 02:42:05 -0700 (PDT) Message-Id: <199708040942.CAA17905@jsbach.n2.net> Date: Mon, 4 Aug 1997 02:42:05 -0700 (PDT) From: fpm@n2.net Reply-To: fpm@n2.net To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: i386/4225: Missing parentheses in /usr/src/sys/i386/isa/isa.c Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 4225 >Category: i386 >Synopsis: Missing parentheses in /usr/src/sys/i386/isa/isa.c >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 4 02:50:01 PDT 1997 >Last-Modified: >Originator: Frank MacLachlan >Organization: N2 Networking >Release: FreeBSD 3.0-CURRENT i386 >Environment: 3.0-CURRENT CVsup'ed 3 Aug 97 at 23:30 PDT. Relevent file is /usr/src/sys/i386/isa/isa.c. File's id is: $Id: isa.c,v 1.99 1997/07/29 05:24:36 msmith Exp $ >Description: A number of if statements in this file assume that the precedence of the '&' operator is higher than the '==' operator and are incorrectly evaluated. The resulting tests are totally useless. >How-To-Repeat: Problem was found while inspecting the code. >Fix: Apply the following patch: *** isa.c.ORIG Sun Aug 3 23:37:00 1997 --- isa.c Mon Aug 4 00:58:06 1997 *************** *** 648,654 **** if (chan & ~VALID_DMA_MASK) panic("isa_dma_release: channel out of range"); ! if (dma_inuse & (1 << chan) == 0) printf("isa_dma_release: channel %d not in use\n", chan); #endif --- 648,654 ---- if (chan & ~VALID_DMA_MASK) panic("isa_dma_release: channel out of range"); ! if ((dma_inuse & (1 << chan)) == 0) printf("isa_dma_release: channel %d not in use\n", chan); #endif *************** *** 705,711 **** || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1))) panic("isa_dmastart: impossible request"); ! if (dma_inuse & (1 << chan) == 0) printf("isa_dmastart: channel %d not acquired\n", chan); #endif --- 705,711 ---- || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1))) panic("isa_dmastart: impossible request"); ! if ((dma_inuse & (1 << chan)) == 0) printf("isa_dmastart: channel %d not acquired\n", chan); #endif *************** *** 813,819 **** if (chan & ~VALID_DMA_MASK) panic("isa_dmadone: channel out of range"); ! if (dma_inuse & (1 << chan) == 0) printf("isa_dmadone: channel %d not acquired\n", chan); #endif --- 813,819 ---- if (chan & ~VALID_DMA_MASK) panic("isa_dmadone: channel out of range"); ! if ((dma_inuse & (1 << chan)) == 0) printf("isa_dmadone: channel %d not acquired\n", chan); #endif *************** *** 823,829 **** * isa_dmastart() once because they use Auto DMA mode. If we * leave this in, drivers that do this will print this continuously. */ ! if (dma_busy & (1 << chan) == 0) printf("isa_dmadone: channel %d not busy\n", chan); #endif --- 823,829 ---- * isa_dmastart() once because they use Auto DMA mode. If we * leave this in, drivers that do this will print this continuously. */ ! if ((dma_busy & (1 << chan)) == 0) printf("isa_dmadone: channel %d not busy\n", chan); #endif *************** *** 910,922 **** u_long ef; /* channel active? */ ! if (dma_inuse & (1 << chan) == 0) { printf("isa_dmastatus: channel %d not active\n", chan); return(-1); } /* still busy? */ ! if (dma_busy & (1 << chan) == 0) { return(0); } --- 910,922 ---- u_long ef; /* channel active? */ ! if ((dma_inuse & (1 << chan)) == 0) { printf("isa_dmastatus: channel %d not active\n", chan); return(-1); } /* still busy? */ ! if ((dma_busy & (1 << chan)) == 0) { return(0); } >Audit-Trail: >Unformatted: