diff options
author | glebius <glebius@FreeBSD.org> | 2011-04-18 09:12:27 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2011-04-18 09:12:27 +0000 |
commit | 6c78a88c3bb5f7c87b56f79915289532c9997f86 (patch) | |
tree | 93e5d9fb7956c5887fdf3d8f3617c0eca1887866 /sys/netgraph/ng_async.c | |
parent | 636bed78e5bc6ab20edda6b6d287c8fb8a71476f (diff) | |
download | FreeBSD-src-6c78a88c3bb5f7c87b56f79915289532c9997f86.zip FreeBSD-src-6c78a88c3bb5f7c87b56f79915289532c9997f86.tar.gz |
Node constructor methods are supposed to be called in syscall
context always. Convert nodes to consistently use M_WAITOK flag
for memory allocation.
Reviewed by: julian
Diffstat (limited to 'sys/netgraph/ng_async.c')
-rw-r--r-- | sys/netgraph/ng_async.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/netgraph/ng_async.c b/sys/netgraph/ng_async.c index acbd76a..283ba15 100644 --- a/sys/netgraph/ng_async.c +++ b/sys/netgraph/ng_async.c @@ -183,25 +183,15 @@ nga_constructor(node_p node) { sc_p sc; - sc = malloc(sizeof(*sc), M_NETGRAPH_ASYNC, M_NOWAIT | M_ZERO); - if (sc == NULL) - return (ENOMEM); + sc = malloc(sizeof(*sc), M_NETGRAPH_ASYNC, M_WAITOK | M_ZERO); sc->amode = MODE_HUNT; sc->cfg.accm = ~0; sc->cfg.amru = NG_ASYNC_DEFAULT_MRU; sc->cfg.smru = NG_ASYNC_DEFAULT_MRU; sc->abuf = malloc(ASYNC_BUF_SIZE(sc->cfg.smru), - M_NETGRAPH_ASYNC, M_NOWAIT); - if (sc->abuf == NULL) - goto fail; + M_NETGRAPH_ASYNC, M_WAITOK); sc->sbuf = malloc(SYNC_BUF_SIZE(sc->cfg.amru), - M_NETGRAPH_ASYNC, M_NOWAIT); - if (sc->sbuf == NULL) { - free(sc->abuf, M_NETGRAPH_ASYNC); -fail: - free(sc, M_NETGRAPH_ASYNC); - return (ENOMEM); - } + M_NETGRAPH_ASYNC, M_WAITOK); NG_NODE_SET_PRIVATE(node, sc); sc->node = node; return (0); |