diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2011-06-17 07:06:48 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2011-06-17 07:06:48 +0000 |
commit | 588580a3636f1d2f89071c40a24811393a93accc (patch) | |
tree | fe14f36309c4c36297658840fbee97ea66114ab6 /sys/netinet6 | |
parent | f54f5c33e3808aca4c742c69b64f7a9619f240cb (diff) |
M_WAITOK cleanup of two cases:
1) Allocating with M_WAITOK, checking for NULL, and calling panic() is
pointless (malloc() will panic if it can't allocate) so remove the check
and the call.
2) Allocating with M_WAITOK, checking for NULL, and then gracefully
handling failure to allocate is pointless. Instead also pass M_CANFAIL
so malloc() doesn't panic so we can actually handle it gracefully.
1) was done using Coccinelle.
Input from oga.
ok miod.
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/nd6.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 4135ca28847..0207bfbf964 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.86 2011/03/09 23:31:24 bluhm Exp $ */ +/* $OpenBSD: nd6.c,v 1.87 2011/06/17 07:06:47 mk Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -2040,7 +2040,7 @@ nd6_sysctl(int name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) ol = oldlenp ? *oldlenp : 0; if (oldp) { - p = malloc(*oldlenp, M_TEMP, M_WAITOK); + p = malloc(*oldlenp, M_TEMP, M_WAITOK | M_CANFAIL); if (!p) return ENOMEM; } else |