git: 9front

Download patch

ref: d703071db24dcc3ecb970ea7bc5748956fd53e21
parent: 94d115a8ab06b8cfbdf5ef41cf4bd569d5fafe29
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Aug 21 06:56:15 EDT 2014

ether8139: fix pointer truncation by ulong cast, use mallocalign()

--- a/sys/src/9/pc/ether8139.c
+++ b/sys/src/9/pc/ether8139.c
@@ -403,7 +403,7 @@
 	/*
 	 * Receiver
 	 */
-	alloc = (uchar*)ROUNDUP((ulong)ctlr->alloc, 32);
+	alloc = ctlr->alloc;
 	ctlr->rbstart = alloc;
 	alloc += ctlr->rblen+16;
 	memset(ctlr->rbstart, 0, ctlr->rblen+16);
@@ -453,7 +453,7 @@
 	qlock(&ctlr->alock);
 	if(ctlr->alloc == nil){
 		ctlr->rblen = 1<<((Rblen>>RblenSHIFT)+13);
-		ctlr->alloc = mallocz(ctlr->rblen+16 + Ntd*Tdbsz + 32, 0);
+		ctlr->alloc = mallocalign(ctlr->rblen+16 + Ntd*Tdbsz, 32, 0, 0);
 		if(ctlr->alloc == nil){
 			qunlock(&ctlr->alock);
 			error(Enomem);
--