Subject: Re: port-mac68k/32583: mac68k netbsd-2 panics during rcp(1)
To: None <port-mac68k-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: netbsd-bugs
Date: 01/25/2006 22:25:02
The following reply was made to PR port-mac68k/32583; it has been noted by GNATS.

From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Cc: Dave Huang <khym@azeotrope.org>,
	Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>,
	Scott Reynolds <scottr@clank.org>, port-mac68k-maintainer@netbsd.org,
	gnats-bugs@netbsd.org
Subject: Re: port-mac68k/32583: mac68k netbsd-2 panics during rcp(1)
Date: Wed, 25 Jan 2006 22:59:48 +0100

 At 22:06 Uhr +0100 25.1.2006, Hauke Fath wrote:
 >At 16:53 Uhr -0600 24.1.2006, Dave Huang wrote:
 >>#define bus_space_set_region_2(t, h, o, val, c) do {                     \
 >>        if (!c) panic("bus_space_set_region_2 called with zero count."); \
 >>        (h).bssr2(t,&(h),o,val,c); } while (0)
 >>
 >>                bus_space_set_region_2(sc->sc_buft, sc->sc_bufh, buf, 0,
 >>                    (ETHER_MIN_LEN - ETHER_CRC_LEN - totlen) >> 1);
 >>
 >>So, that "if" line expands to:
 >>
 >>	if (!(ETHER_MIN_LEN - ETHER_CRC_LEN - totlen) >> 1) panic([...]);
 >>
 >>ETHER_MIN_LEN - ETHER_CRC_LEN - totlen == 1, so that's
 >>	if (!(1) >> 1) panic();
 >>or
 >>	if (0 >> 1) panic();
 >>
 >>Needs more parentheses :)
 >
 >Meaning you'd want
 >
 >if (!(c)) panic(...)
 >
 >instead above?
 
 login: panic: bus_space_set_region_2 called with zero count.
 Stopped in pid 38.1 (rcmd) at   netbsd:cpu_Debugger+0x6:        unlk    a6
 db>
 
 - better that way.
 
 
 [hauke@pizza] /<5>mac68k/dev > cvs diff -u if_ae.c
 Index: if_ae.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/mac68k/dev/if_ae.c,v
 retrieving revision 1.75
 diff -u -u -r1.75 if_ae.c
 --- if_ae.c     15 Jul 2003 02:43:16 -0000      1.75
 +++ if_ae.c     25 Jan 2006 21:58:10 -0000
 @@ -180,7 +180,7 @@
         }
         if (totlen < ETHER_MIN_LEN - ETHER_CRC_LEN) {
                 bus_space_set_region_2(sc->sc_buft, sc->sc_bufh, buf, 0,
 -                   (ETHER_MIN_LEN - ETHER_CRC_LEN - totlen) >> 1);
 +                   ((ETHER_MIN_LEN - ETHER_CRC_LEN - totlen + 1) >> 1));
                 totlen = ETHER_MIN_LEN - ETHER_CRC_LEN;
         }
         return (totlen);
 
 
 fixes the issue.
 
 Many thanks, gentlemen.  :)
 
 	hauke
 
 --
 "It's never straight up and down"     (DEVO)