ref: 4687e196cc6afa63754f8928154dc3bbf276dda5
parent: 0bc9ad781fdc9e4cfcd5fed1560775e241a366fc
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Mar 24 23:03:24 EDT 2015
zynq: fix out of bounds access in etherprobe() calling etherprobe() with -1 cardno will rereference and call cards[-1].reset() which is wrong. don't do that!
--- a/sys/src/9/zynq/devether.c
+++ b/sys/src/9/zynq/devether.c
@@ -435,12 +435,6 @@
Ether *ether;
int cardno, ctlrno;
- for(ctlrno = 0; ctlrno < MaxEther; ctlrno++){
- if((ether = etherprobe(-1, ctlrno)) == nil)
- continue;
- etherxx[ctlrno] = ether;
- }
-
cardno = ctlrno = 0;
while(cards[cardno].type != nil && ctlrno < MaxEther){
if(etherxx[ctlrno] != nil){
--- a/sys/src/9/zynq/etherif.h
+++ b/sys/src/9/zynq/etherif.h
@@ -1,5 +1,5 @@
enum {
- MaxEther = 64,
+ MaxEther = 1,
Ntypes = 8,
};