diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-12-12 22:24:25 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-12-12 22:24:25 +0100 |
commit | 9679d7525c205de90e9dcadcf6762b04114f8c45 (patch) | |
tree | 8681e308104e48eed2753c1b76eba1a8bac57341 /sys/src/9/pc/ether8139.c | |
parent | f32ef135d4bce251f72275d30cfcd86cb188b8c9 (diff) |
kernel: fix more malloc bugs
Diffstat (limited to 'sys/src/9/pc/ether8139.c')
-rw-r--r-- | sys/src/9/pc/ether8139.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/src/9/pc/ether8139.c b/sys/src/9/pc/ether8139.c index f304df603..bffa7956f 100644 --- a/sys/src/9/pc/ether8139.c +++ b/sys/src/9/pc/ether8139.c @@ -454,6 +454,10 @@ rtl8139attach(Ether* edev) if(ctlr->alloc == nil){ ctlr->rblen = 1<<((Rblen>>RblenSHIFT)+13); ctlr->alloc = mallocz(ctlr->rblen+16 + Ntd*Tdbsz + 32, 0); + if(ctlr->alloc == nil){ + qunlock(&ctlr->alock); + error(Enomem); + } rtl8139init(edev); } qunlock(&ctlr->alock); @@ -752,6 +756,10 @@ rtl8139pnp(Ether* edev) if(p->ccrb != 0x02 || p->ccru != 0) continue; ctlr = malloc(sizeof(Ctlr)); + if(ctlr == nil){ + print("rtl8139: can't allocate memory\n"); + continue; + } ctlr->pcidev = p; ctlr->id = (p->did<<16)|p->vid; |