diff options
-rw-r--r-- | sys/net/if_mpe.c | 7 | ||||
-rw-r--r-- | sys/net/if_mpw.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index 7d185c4bded..a3862e67be3 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.79 2019/02/10 22:36:34 dlg Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.80 2019/02/11 00:11:24 dlg Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -93,7 +93,10 @@ mpe_clone_create(struct if_clone *ifc, int unit) struct mpe_softc *sc; struct ifnet *ifp; - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_CANFAIL|M_ZERO); + if (sc == NULL) + return (ENOMEM); + ifp = &sc->sc_if; snprintf(ifp->if_xname, sizeof ifp->if_xname, "mpe%d", unit); ifp->if_flags = IFF_POINTOPOINT; diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c index 2bc7104d04f..f58729c8530 100644 --- a/sys/net/if_mpw.c +++ b/sys/net/if_mpw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpw.c,v 1.32 2019/02/10 22:58:05 dlg Exp $ */ +/* $OpenBSD: if_mpw.c,v 1.33 2019/02/11 00:11:24 dlg Exp $ */ /* * Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org> @@ -83,7 +83,10 @@ mpw_clone_create(struct if_clone *ifc, int unit) struct mpw_softc *sc; struct ifnet *ifp; - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_CANFAIL|M_ZERO); + if (sc == NULL) + return (ENOMEM); + ifp = &sc->sc_if; snprintf(ifp->if_xname, sizeof(ifp->if_xname), "%s%d", ifc->ifc_name, unit); |