diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-04-25 09:43:05 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-04-25 09:43:05 +0000 |
commit | 2fd1b2960b82fc7e005122375345eaf789b04b83 (patch) | |
tree | 4780f59438574e8e721c2bbca0935e1ea520744e /sys/dev/pci/mpii.c | |
parent | a2167dc48eac0fc606f8e40068626fa2a506cfc4 (diff) |
don't access a pointer till after the null check
ok mikeb@
Diffstat (limited to 'sys/dev/pci/mpii.c')
-rw-r--r-- | sys/dev/pci/mpii.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index 09d2c547047..b4cc347df3f 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpii.c,v 1.92 2014/04/10 01:28:32 dlg Exp $ */ +/* $OpenBSD: mpii.c,v 1.93 2014/04/25 09:43:04 jsg Exp $ */ /* * Copyright (c) 2010, 2012 Mike Belopuhov * Copyright (c) 2009 James Giannoules @@ -2297,10 +2297,11 @@ mpii_dmamem_free(struct mpii_softc *sc, struct mpii_dmamem *mdm) int mpii_insert_dev(struct mpii_softc *sc, struct mpii_device *dev) { - int slot = dev->slot; /* initial hint */ + int slot; /* initial hint */ - if (dev == NULL || slot < 0) + if (dev == NULL || dev->slot < 0) return (1); + slot = dev->slot; while (slot < sc->sc_max_devices && sc->sc_devs[slot] != NULL) slot++; |