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!
This commit is contained in:
cinap_lenrek 2015-03-25 03:03:24 +01:00
parent 0bc9ad781f
commit 4687e196cc
2 changed files with 1 additions and 7 deletions

View file

@ -435,12 +435,6 @@ etherreset(void)
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){

View file

@ -1,5 +1,5 @@
enum {
MaxEther = 64,
MaxEther = 1,
Ntypes = 8,
};