summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/etherbcm.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-12-12 22:24:25 +0100
committercinap_lenrek <cinap_lenrek@centraldogma>2011-12-12 22:24:25 +0100
commit9679d7525c205de90e9dcadcf6762b04114f8c45 (patch)
tree8681e308104e48eed2753c1b76eba1a8bac57341 /sys/src/9/pc/etherbcm.c
parentf32ef135d4bce251f72275d30cfcd86cb188b8c9 (diff)
kernel: fix more malloc bugs
Diffstat (limited to 'sys/src/9/pc/etherbcm.c')
-rw-r--r--sys/src/9/pc/etherbcm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/src/9/pc/etherbcm.c b/sys/src/9/pc/etherbcm.c
index afe9d8e44..7537ec5f6 100644
--- a/sys/src/9/pc/etherbcm.c
+++ b/sys/src/9/pc/etherbcm.c
@@ -791,6 +791,12 @@ bcmpci(void)
print("bcm: unable to alloc Ctlr\n");
continue;
}
+ ctlr->sends = malloc(sizeof(ctlr->sends[0]) * SendRingLen);
+ if(ctlr->sends == nil){
+ print("bcm: unable to alloc ctlr->sends\n");
+ free(ctlr);
+ continue;
+ }
mem = vmap(pdev->mem[0].bar & ~0x0F, pdev->mem[0].size);
if(mem == nil) {
print("bcm: can't map %8.8luX\n", pdev->mem[0].bar);
@@ -804,7 +810,6 @@ bcmpci(void)
ctlr->recvprod = xspanalloc(32 * RecvProdRingLen, 16, 0);
ctlr->recvret = xspanalloc(32 * RecvRetRingLen, 16, 0);
ctlr->sendr = xspanalloc(16 * SendRingLen, 16, 0);
- ctlr->sends = malloc(sizeof(Block) * SendRingLen);
if(bcmhead != nil)
bcmtail->link = ctlr;
else