diff options
author | 2006-04-17 04:45:02 +0000 | |
---|---|---|
committer | 2006-04-17 04:45:02 +0000 | |
commit | ce5c46d42b01cbfef1935faa46c739931ce835a9 (patch) | |
tree | da7d5190fabc66d148e5be8b72c06db3926c1540 /sys/dev | |
parent | sync (diff) | |
download | wireguard-openbsd-ce5c46d42b01cbfef1935faa46c739931ce835a9.tar.xz wireguard-openbsd-ce5c46d42b01cbfef1935faa46c739931ce835a9.zip |
Coviery CID 1108: Avoid NULL pointer deref.
Coverity CID 1105: Avoid NULL deref.
From NetBSD
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_sk.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 3c5f1f74e31..cb00c98c8e7 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.96 2006/03/25 22:41:45 djm Exp $ */ +/* $OpenBSD: if_sk.c,v 1.97 2006/04/17 04:45:02 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -2236,38 +2236,40 @@ sk_intr(void *xsc) claimed = 1; /* Handle receive interrupts first. */ - if (status & SK_ISR_RX1_EOF) { + if (sc_if0 && (status & SK_ISR_RX1_EOF)) { sk_rxeof(sc_if0); CSR_WRITE_4(sc, SK_BMU_RX_CSR0, SK_RXBMU_CLR_IRQ_EOF|SK_RXBMU_RX_START); } - if (status & SK_ISR_RX2_EOF) { + if (sc_if1 && (status & SK_ISR_RX2_EOF)) { sk_rxeof(sc_if1); CSR_WRITE_4(sc, SK_BMU_RX_CSR1, SK_RXBMU_CLR_IRQ_EOF|SK_RXBMU_RX_START); } /* Then transmit interrupts. */ - if (status & SK_ISR_TX1_S_EOF) { + if (sc_if0 && (status & SK_ISR_TX1_S_EOF)) { sk_txeof(sc_if0); CSR_WRITE_4(sc, SK_BMU_TXS_CSR0, SK_TXBMU_CLR_IRQ_EOF); } - if (status & SK_ISR_TX2_S_EOF) { + if (sc_if1 && (status & SK_ISR_TX2_S_EOF)) { sk_txeof(sc_if1); CSR_WRITE_4(sc, SK_BMU_TXS_CSR1, SK_TXBMU_CLR_IRQ_EOF); } /* Then MAC interrupts. */ - if (status & SK_ISR_MAC1 && (ifp0->if_flags & IFF_RUNNING)) { + if (sc_if0 && (status & SK_ISR_MAC1) && + (ifp0->if_flags & IFF_RUNNING)) { if (sc->sk_type == SK_GENESIS) sk_intr_xmac(sc_if0); else sk_intr_yukon(sc_if0); } - if (status & SK_ISR_MAC2 && (ifp1->if_flags & IFF_RUNNING)) { + if (sc_if1 && (status & SK_ISR_MAC2) && + (ifp1->if_flags & IFF_RUNNING)) { if (sc->sk_type == SK_GENESIS) sk_intr_xmac(sc_if1); else @@ -2276,11 +2278,11 @@ sk_intr(void *xsc) } if (status & SK_ISR_EXTERNAL_REG) { - if (ifp0 != NULL && + if (sc_if0 != NULL && sc_if0->sk_phytype == SK_PHYTYPE_BCOM) sk_intr_bcom(sc_if0); - if (ifp1 != NULL && + if (sc_if1 != NULL && sc_if1->sk_phytype == SK_PHYTYPE_BCOM) sk_intr_bcom(sc_if1); } |