summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-04-17 04:45:03 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-04-17 04:45:03 +0000
commit64372536ba743728274c93af0efbea8b2e30f6ac (patch)
tree9ed3800d1f5731d342f6e5b721a6870cc9fa8567 /sys/dev
parent79ed7642e222e2f83a8fdd606c6299834be4f40e (diff)
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.c20
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);
}