Date: Mon, 4 Aug 1997 02:42:05 -0700 (PDT) From: fpm@n2.net To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: i386/4225: Missing parentheses in /usr/src/sys/i386/isa/isa.c Message-ID: <199708040942.CAA17905@jsbach.n2.net> Resent-Message-ID: <199708040950.CAA24492@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708040942.CAA17905>
