summaryrefslogtreecommitdiff
path: root/sys/net/bfd.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-09-07 09:23:08 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-09-07 09:23:08 +0000
commitda67be5d9d13eed4e814cb1a31bb4bdfa31e4d21 (patch)
treead8ba05df1ddb33d110e580eab211c1691569665 /sys/net/bfd.c
parenta2ac3b98912f889b67a4969b68ce2c860624ad44 (diff)
Do not check for NULL after calling an allocator with WAITOK.
All allocations are done during ioctl() so it is safe to sleep. ok claudio@, phessler@
Diffstat (limited to 'sys/net/bfd.c')
-rw-r--r--sys/net/bfd.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/net/bfd.c b/sys/net/bfd.c
index 900eb9b1f44..9af8e5f8b9f 100644
--- a/sys/net/bfd.c
+++ b/sys/net/bfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bfd.c,v 1.20 2016/09/07 09:21:33 mpi Exp $ */
+/* $OpenBSD: bfd.c,v 1.21 2016/09/07 09:23:07 mpi Exp $ */
/*
* Copyright (c) 2016 Peter Hessler <phessler@openbsd.org>
@@ -209,11 +209,8 @@ bfd_rtalloc(struct rtentry *rt)
return (EADDRINUSE);
/* Do our necessary memory allocations upfront */
- if ((sc = pool_get(&bfd_pool, PR_WAITOK | PR_ZERO)) == NULL)
- goto fail;
- if ((sc->sc_peer = pool_get(&bfd_pool_peer, PR_WAITOK | PR_ZERO)) ==
- NULL)
- goto fail;
+ sc = pool_get(&bfd_pool, PR_WAITOK | PR_ZERO);
+ sc->sc_peer = pool_get(&bfd_pool_peer, PR_WAITOK | PR_ZERO);
sc->sc_rt = rt;
rtref(sc->sc_rt); /* we depend on this route not going away */
@@ -232,13 +229,6 @@ bfd_rtalloc(struct rtentry *rt)
TAILQ_INSERT_TAIL(&bfd_queue, sc, bfd_next);
return (0);
-
-fail:
- if (sc->sc_peer)
- pool_put(&bfd_pool_peer, sc->sc_peer);
- if (sc)
- pool_put(&bfd_pool, sc);
- return (ENOMEM);
}
/*