ether8139: fix pointer truncation by ulong cast, use mallocalign()
This commit is contained in:
parent
2161885034
commit
15755a5f83
1 changed files with 2 additions and 2 deletions
|
@ -403,7 +403,7 @@ rtl8139init(Ether* edev)
|
||||||
/*
|
/*
|
||||||
* Receiver
|
* Receiver
|
||||||
*/
|
*/
|
||||||
alloc = (uchar*)ROUNDUP((ulong)ctlr->alloc, 32);
|
alloc = ctlr->alloc;
|
||||||
ctlr->rbstart = alloc;
|
ctlr->rbstart = alloc;
|
||||||
alloc += ctlr->rblen+16;
|
alloc += ctlr->rblen+16;
|
||||||
memset(ctlr->rbstart, 0, ctlr->rblen+16);
|
memset(ctlr->rbstart, 0, ctlr->rblen+16);
|
||||||
|
@ -453,7 +453,7 @@ rtl8139attach(Ether* edev)
|
||||||
qlock(&ctlr->alock);
|
qlock(&ctlr->alock);
|
||||||
if(ctlr->alloc == nil){
|
if(ctlr->alloc == nil){
|
||||||
ctlr->rblen = 1<<((Rblen>>RblenSHIFT)+13);
|
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){
|
if(ctlr->alloc == nil){
|
||||||
qunlock(&ctlr->alock);
|
qunlock(&ctlr->alock);
|
||||||
error(Enomem);
|
error(Enomem);
|
||||||
|
|
Loading…
Reference in a new issue