summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-01-09 15:24:25 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-01-09 15:24:25 +0000
commit630ce3acafb6c26deb5d91610e9d8875a6b6bc61 (patch)
treef8c88944a39775dc96058c94e316bc99c8dca96d
parentb6ab100d040502e7a25daea02f44fa22cc465cbe (diff)
Creating a cloned interface could return ENOMEM due to temporary
memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
-rw-r--r--sys/net/if_bridge.c7
-rw-r--r--sys/net/if_etherip.c6
-rw-r--r--sys/net/if_gif.c7
-rw-r--r--sys/net/if_gre.c12
-rw-r--r--sys/net/if_loop.c8
-rw-r--r--sys/net/if_mpe.c7
-rw-r--r--sys/net/if_mpw.c7
-rw-r--r--sys/net/if_pair.c7
-rw-r--r--sys/net/if_pflog.c7
-rw-r--r--sys/net/if_pflow.c8
-rw-r--r--sys/net/if_pfsync.c5
-rw-r--r--sys/net/if_ppp.c7
-rw-r--r--sys/net/if_pppoe.c7
-rw-r--r--sys/net/if_switch.c4
-rw-r--r--sys/net/if_trunk.c6
-rw-r--r--sys/net/if_tun.c7
-rw-r--r--sys/net/if_vether.c7
-rw-r--r--sys/net/if_vlan.c7
-rw-r--r--sys/net/if_vxlan.c7
-rw-r--r--sys/netinet/ip_carp.c7
20 files changed, 39 insertions, 101 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 5a734c9d65f..425d90fb0bc 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.299 2017/11/20 10:17:40 mpi Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.300 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -156,10 +156,7 @@ bridge_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
int i;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (!sc)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
sc->sc_stp = bstp_create(&sc->sc_if);
if (!sc->sc_stp) {
free(sc, M_DEVBUF, sizeof *sc);
diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c
index b7633a6e91d..e4e3c439b7d 100644
--- a/sys/net/if_etherip.c
+++ b/sys/net/if_etherip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_etherip.c,v 1.28 2017/11/20 10:35:24 mpi Exp $ */
+/* $OpenBSD: if_etherip.c,v 1.29 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@@ -99,9 +99,7 @@ etherip_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct etherip_softc *sc;
- if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return ENOMEM;
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_ac.ac_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "etherip%d", unit);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 3ef20bd6b46..d3c6a427302 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.106 2018/01/09 10:08:01 mpi Exp $ */
+/* $OpenBSD: if_gif.c,v 1.107 2018/01/09 15:24:24 bluhm Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -107,10 +107,7 @@ gif_clone_create(struct if_clone *ifc, int unit)
{
struct gif_softc *sc;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (!sc)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(sc->gif_if.if_xname, sizeof sc->gif_if.if_xname,
"%s%d", ifc->ifc_name, unit);
sc->gif_if.if_mtu = GIF_MTU;
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 51bb25d4065..28ab595c2f0 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.88 2017/10/20 09:35:09 mpi Exp $ */
+/* $OpenBSD: if_gre.c,v 1.89 2018/01/09 15:24:24 bluhm Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -122,14 +122,11 @@ gre_clone_create(struct if_clone *ifc, int unit)
{
struct gre_softc *sc;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (!sc)
- return (ENOMEM);
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(sc->sc_if.if_xname, sizeof sc->sc_if.if_xname, "%s%d",
ifc->ifc_name, unit);
sc->sc_if.if_softc = sc;
sc->sc_if.if_type = IFT_TUNNEL;
- sc->sc_if.if_addrlen = 0;
sc->sc_if.if_hdrlen = 24; /* IP + GRE */
sc->sc_if.if_mtu = GREMTU;
sc->sc_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
@@ -137,11 +134,6 @@ gre_clone_create(struct if_clone *ifc, int unit)
sc->sc_if.if_output = gre_output;
sc->sc_if.if_ioctl = gre_ioctl;
sc->sc_if.if_rtrequest = p2p_rtrequest;
- sc->sc_if.if_collisions = 0;
- sc->sc_if.if_ierrors = 0;
- sc->sc_if.if_oerrors = 0;
- sc->sc_if.if_ipackets = 0;
- sc->sc_if.if_opackets = 0;
sc->g_dst.s_addr = sc->g_src.s_addr = INADDR_ANY;
sc->sc_ka_state = GRE_STATE_UKNWN;
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 66ca33c92d7..5ff594ef091 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_loop.c,v 1.84 2017/12/15 01:37:30 dlg Exp $ */
+/* $OpenBSD: if_loop.c,v 1.85 2018/01/09 15:24:24 bluhm Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
@@ -167,10 +167,7 @@ loop_clone_create(struct if_clone *ifc, int unit)
{
struct ifnet *ifp;
- ifp = malloc(sizeof(*ifp), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (ifp == NULL)
- return (ENOMEM);
-
+ ifp = malloc(sizeof(*ifp), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(ifp->if_xname, sizeof ifp->if_xname, "lo%d", unit);
ifp->if_softc = NULL;
ifp->if_mtu = LOMTU;
@@ -181,7 +178,6 @@ loop_clone_create(struct if_clone *ifc, int unit)
ifp->if_output = looutput;
ifp->if_type = IFT_LOOP;
ifp->if_hdrlen = sizeof(u_int32_t);
- ifp->if_addrlen = 0;
if (unit == 0) {
if_attachhead(ifp);
if_addgroup(ifp, ifc->ifc_name);
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 28cf41e99bb..e15c821bb00 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.63 2017/11/29 19:36:03 claudio Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.64 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -81,10 +81,7 @@ mpe_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct mpe_softc *mpeif;
- if ((mpeif = malloc(sizeof(*mpeif),
- M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ mpeif = malloc(sizeof(*mpeif), M_DEVBUF, M_WAITOK|M_ZERO);
mpeif->sc_unit = unit;
ifp = &mpeif->sc_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "mpe%d", unit);
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index 27dff0aaf22..e51b4b69d88 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.22 2017/05/15 14:03:53 mpi Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.23 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -83,10 +83,7 @@ mpw_clone_create(struct if_clone *ifc, int unit)
struct mpw_softc *sc;
struct ifnet *ifp;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (sc == NULL)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_if;
snprintf(ifp->if_xname, sizeof(ifp->if_xname), "mpw%d", unit);
ifp->if_softc = sc;
diff --git a/sys/net/if_pair.c b/sys/net/if_pair.c
index 36645299d2c..1a6684c4607 100644
--- a/sys/net/if_pair.c
+++ b/sys/net/if_pair.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pair.c,v 1.10 2017/01/23 11:37:29 mpi Exp $ */
+/* $OpenBSD: if_pair.c,v 1.11 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -108,10 +108,7 @@ pair_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct pair_softc *sc;
- if ((sc = malloc(sizeof(*sc),
- M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_ac.ac_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "pair%d", unit);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c
index 89473110cd0..47783944a27 100644
--- a/sys/net/if_pflog.c
+++ b/sys/net/if_pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflog.c,v 1.80 2017/08/11 21:24:19 mpi Exp $ */
+/* $OpenBSD: if_pflog.c,v 1.81 2018/01/09 15:24:24 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -137,10 +137,7 @@ pflog_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct pflog_softc *pflogif;
- if ((pflogif = malloc(sizeof(*pflogif),
- M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ pflogif = malloc(sizeof(*pflogif), M_DEVBUF, M_WAITOK|M_ZERO);
pflogif->sc_unit = unit;
ifp = &pflogif->sc_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "pflog%d", unit);
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index 9fb8ecf0ade..1d5627b907c 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.85 2017/10/31 22:05:12 sashan Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.86 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -145,12 +145,8 @@ pflow_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct pflow_softc *pflowif;
- if ((pflowif = malloc(sizeof(*pflowif),
- M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ pflowif = malloc(sizeof(*pflowif), M_DEVBUF, M_WAITOK|M_ZERO);
MGET(pflowif->send_nam, M_WAIT, MT_SONAME);
-
pflowif->sc_version = PFLOW_PROTO_DEFAULT;
/* ipfix template init */
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 7c03704adba..919ddeacad0 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.255 2017/11/20 10:35:24 mpi Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.256 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -300,8 +300,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit)
pfsync_sync_ok = 1;
- sc = malloc(sizeof(*pfsyncif), M_DEVBUF, M_WAITOK | M_ZERO);
-
+ sc = malloc(sizeof(*pfsyncif), M_DEVBUF, M_WAITOK|M_ZERO);
for (q = 0; q < PFSYNC_S_COUNT; q++)
TAILQ_INIT(&sc->sc_qs[q]);
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index 500eb6014c9..922e57a03fa 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ppp.c,v 1.109 2017/08/11 21:24:19 mpi Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.110 2018/01/09 15:24:24 bluhm Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/*
@@ -205,10 +205,7 @@ ppp_clone_create(struct if_clone *ifc, int unit)
{
struct ppp_softc *sc;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (!sc)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
sc->sc_unit = unit;
snprintf(sc->sc_if.if_xname, sizeof sc->sc_if.if_xname, "%s%d",
ifc->ifc_name, unit);
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 10947b36274..0252c10f4df 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.65 2017/09/08 05:36:53 deraadt Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.66 2018/01/09 15:24:24 bluhm Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -196,10 +196,7 @@ pppoe_clone_create(struct if_clone *ifc, int unit)
struct pppoe_softc *sc, *tmpsc;
u_int32_t unique;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_CANFAIL|M_ZERO);
- if (sc == NULL)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(sc->sc_sppp.pp_if.if_xname,
sizeof(sc->sc_sppp.pp_if.if_xname),
"pppoe%d", unit);
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c
index 9af8528352e..4b816345760 100644
--- a/sys/net/if_switch.c
+++ b/sys/net/if_switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_switch.c,v 1.21 2017/11/20 10:17:40 mpi Exp $ */
+/* $OpenBSD: if_switch.c,v 1.22 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -151,7 +151,6 @@ switch_clone_create(struct if_clone *ifc, int unit)
sc = malloc(sizeof(struct switch_softc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_if;
-
snprintf(ifp->if_xname, sizeof ifp->if_xname, "switch%d", unit);
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU;
@@ -159,7 +158,6 @@ switch_clone_create(struct if_clone *ifc, int unit)
ifp->if_output = NULL;
ifp->if_start = NULL;
ifp->if_type = IFT_BRIDGE;
- ifp->if_addrlen = 0;
ifp->if_hdrlen = ETHER_HDR_LEN;
TAILQ_INIT(&sc->sc_swpo_list);
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index 3b27c0399ac..2e61223a8ce 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.134 2017/08/14 08:31:00 reyk Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.135 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -157,9 +157,7 @@ trunk_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
int i, error = 0;
- if ((tr = malloc(sizeof *tr, M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ tr = malloc(sizeof(*tr), M_DEVBUF, M_WAITOK|M_ZERO);
tr->tr_unit = unit;
tr->tr_proto = TRUNK_PROTO_NONE;
for (i = 0; trunk_protos[i].ti_proto != TRUNK_PROTO_NONE; i++) {
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 3a7fd26d0b1..81dd0148a3f 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.179 2017/12/30 23:08:29 guenther Exp $ */
+/* $OpenBSD: if_tun.c,v 1.180 2018/01/09 15:24:24 bluhm Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -193,10 +193,7 @@ tun_create(struct if_clone *ifc, int unit, int flags)
struct tun_softc *tp;
struct ifnet *ifp;
- tp = malloc(sizeof(*tp), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (tp == NULL)
- return (ENOMEM);
-
+ tp = malloc(sizeof(*tp), M_DEVBUF, M_WAITOK|M_ZERO);
tp->tun_unit = unit;
tp->tun_flags = TUN_INITED|TUN_STAYUP;
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c
index 77938e0b7c8..f3daf849dc2 100644
--- a/sys/net/if_vether.c
+++ b/sys/net/if_vether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vether.c,v 1.29 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_vether.c,v 1.30 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2009 Theo de Raadt
@@ -75,10 +75,7 @@ vether_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct vether_softc *sc;
- if ((sc = malloc(sizeof(*sc),
- M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_ac.ac_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "vether%d", unit);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index b2d1ddf3b7f..0a66004d1fe 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.174 2017/06/22 11:34:51 tom Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.175 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -157,10 +157,7 @@ vlan_clone_create(struct if_clone *ifc, int unit)
struct ifvlan *ifv;
struct ifnet *ifp;
- ifv = malloc(sizeof(*ifv), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (ifv == NULL)
- return (ENOMEM);
-
+ ifv = malloc(sizeof(*ifv), M_DEVBUF, M_WAITOK|M_ZERO);
LIST_INIT(&ifv->vlan_mc_listhead);
ifp = &ifv->ifv_if;
ifp->if_softc = ifv;
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 07f9b7739e2..107f6a51bde 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vxlan.c,v 1.64 2017/11/20 10:35:24 mpi Exp $ */
+/* $OpenBSD: if_vxlan.c,v 1.65 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
@@ -125,10 +125,7 @@ vxlan_clone_create(struct if_clone *ifc, int unit)
struct ifnet *ifp;
struct vxlan_softc *sc;
- if ((sc = malloc(sizeof(*sc),
- M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
sc->sc_imo.imo_membership = malloc(
(sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS,
M_WAITOK|M_ZERO);
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 50f37e2deaf..1375cb5d2c0 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.320 2017/11/23 13:32:25 mpi Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.321 2018/01/09 15:24:24 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -785,10 +785,7 @@ carp_clone_create(struct if_clone *ifc, int unit)
struct carp_softc *sc;
struct ifnet *ifp;
- sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (!sc)
- return (ENOMEM);
-
+ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
refcnt_init(&sc->sc_refcnt);
SRPL_INIT(&sc->carp_vhosts);