From 1a6d523d266b7c8d97d8557874f4571c6e4465f4 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 18 Jun 2013 02:00:05 +0200 Subject: nusb/ether: fix asixwrite() invert/shift in wrong order causing low 16 bits to be all ffff... --- sys/src/cmd/nusb/ether/asix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/src/cmd/nusb') diff --git a/sys/src/cmd/nusb/ether/asix.c b/sys/src/cmd/nusb/ether/asix.c index 2b8f507ea..4bef7121e 100644 --- a/sys/src/cmd/nusb/ether/asix.c +++ b/sys/src/cmd/nusb/ether/asix.c @@ -242,9 +242,12 @@ asixread(Dev *ep, uchar *p, int plen) static void asixwrite(Dev *ep, uchar *p, int n) { + uint hd; + if(n > sizeof(bout)-8) n = sizeof(bout)-8; - PUT4(bout, n | ~(n<<16)); + hd = n | (n<<16)^0xFFFF0000; + PUT4(bout, hd); memmove(bout+4, p, n); n += 4; if((n % ep->maxpkt) == 0){ -- cgit v1.2.3