From: deraadt Date: Thu, 16 Dec 2021 00:54:42 +0000 (+0000) Subject: pool_get w/ PR_ZERO is better than following with a bzero, because pools X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4023ddd7d2e6b6e627f7c435c56b15aa3f050546;p=openbsd pool_get w/ PR_ZERO is better than following with a bzero, because pools hold dirty and clean memory, and can hand out the right time cheaper ok dlg --- diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c index bab21d96c74..996ab20d9e4 100644 --- a/sys/net/if_wg.c +++ b/sys/net/if_wg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wg.c,v 1.18 2021/08/05 13:37:04 sthen Exp $ */ +/* $OpenBSD: if_wg.c,v 1.19 2021/12/16 00:54:42 deraadt Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. @@ -599,9 +599,8 @@ wg_aip_add(struct wg_softc *sc, struct wg_peer *peer, struct wg_aip_io *d) default: return EAFNOSUPPORT; } - if ((aip = pool_get(&wg_aip_pool, PR_NOWAIT)) == NULL) + if ((aip = pool_get(&wg_aip_pool, PR_NOWAIT|PR_ZERO)) == NULL) return ENOBUFS; - bzero(aip, sizeof(*aip)); rw_enter_write(&root->ar_lock); node = art_insert(root, &aip->a_node, &d->a_addr, d->a_cidr);