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: 09/04/2006 00:30:06
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: khym@azeotrope.org
Cc: 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: Mon, 4 Sep 2006 02:19:50 +0200

 At 18:44 Uhr -0500 3.9.2006, khym@azeotrope.org wrote:
 >Hmm, Scott's patch has:
 >
 >	if (len-- > 0)
 >		totlen++;
 >	len--;
 >
 >rather than
 >
 >	if (len > 0)
 >		totlen++;
 >	len--;
 >
 >?
 
 No; maybe I should have waited for the other half of my mind coming back
 from the Scottish Highlands first.  ;)
 
 The mail with the last patch he sent me, and which works for me, in full
 length:
 
 <snip>
 From: Scott Reynolds <scottr@clank.org>
 Subject: Re: port-mac68k/32583: mac68k netbsd-2 panics during rcp(1)
 Date: Tue, 31 Jan 2006 01:11:51 -0600
 To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
 
 OK, so I didn't account for totlen being one less than ETHER_MIN_LEN
 - ETHER_CRC_LEN. This catches that case. (If it's easier, just add
 the "if (len > 0) totlen++;" lines before the "len--".)
 
 Sorry for any hassle -- I really appreciate you double checking my
 work. I don't have any machines running with an ae interface at the
 moment.
 
 --scott
 
 Index: if_ae.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/mac68k/dev/if_ae.c,v
 retrieving revision 1.75
 diff -c -r1.75 if_ae.c
 *** if_ae.c	15 Jul 2003 02:43:16 -0000	1.75
 --- if_ae.c	31 Jan 2006 07:04:53 -0000
 ***************
 *** 172,186 ****
    		}
    	}
 
    	if (wantbyte) {
    		savebyte[1] = 0;
    		bus_space_write_region_2(sc->sc_buft, sc->sc_bufh,
    		    buf, (u_int16_t *)savebyte, 1);
 ! 		    buf += 2;
    	}
 ! 	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);
    		totlen = ETHER_MIN_LEN - ETHER_CRC_LEN;
    	}
    	return (totlen);
 --- 172,190 ----
    		}
    	}
 
 + 	len = ETHER_MIN_LEN - ETHER_CRC_LEN - totlen;
    	if (wantbyte) {
    		savebyte[1] = 0;
    		bus_space_write_region_2(sc->sc_buft, sc->sc_bufh,
    		    buf, (u_int16_t *)savebyte, 1);
 ! 		buf += 2;
 ! 		if (len > 0)
 ! 			totlen++;
 ! 		len--;
    	}
 ! 	if (len > 0) {
    		bus_space_set_region_2(sc->sc_buft, sc->sc_bufh, buf, 0,
 ! 		    len >> 1);
    		totlen = ETHER_MIN_LEN - ETHER_CRC_LEN;
    	}
    	return (totlen);
 
 </snip>
 
 --
 "It's never straight up and down"     (DEVO)