diff options
author | 2014-04-25 09:41:21 +0000 | |
---|---|---|
committer | 2014-04-25 09:41:21 +0000 | |
commit | 49f5879f474dbc9589f8234822c81529730ab9bf (patch) | |
tree | b947ba89ada83a3ce07aa8889e48384dfb4410a5 | |
parent | Support running user-defined actions on receipt of snmp traps. (diff) | |
download | wireguard-openbsd-49f5879f474dbc9589f8234822c81529730ab9bf.tar.xz wireguard-openbsd-49f5879f474dbc9589f8234822c81529730ab9bf.zip |
don't access a pointer till after the null check
ok mikeb@
-rw-r--r-- | sbin/iked/pfkey.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/mpii.c | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sbin/iked/pfkey.c b/sbin/iked/pfkey.c index 09f1626b4ac..69c76a8b7ca 100644 --- a/sbin/iked/pfkey.c +++ b/sbin/iked/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.29 2014/02/21 20:52:38 markus Exp $ */ +/* $OpenBSD: pfkey.c,v 1.30 2014/04/25 09:41:21 jsg Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -1521,7 +1521,7 @@ pfkey_process(struct iked *env, struct pfkey_message *pm) struct sadb_x_policy sa_pol; struct sockaddr *ssrc, *sdst, *smask, *dmask, *speer; struct iovec iov[IOV_CNT]; - int iov_cnt, sd = env->sc_pfkey; + int iov_cnt, sd; u_int8_t *reply; ssize_t rlen; const char *errmsg = NULL; @@ -1532,6 +1532,7 @@ pfkey_process(struct iked *env, struct pfkey_message *pm) if (!env || !data || !len) return; + sd = env->sc_pfkey; hdr = (struct sadb_msg *)data; switch (hdr->sadb_msg_type) { 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++; |