crypto: move all zeroing into crypto_getreq

Reviewed by:	jhb, markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36774
This commit is contained in:
Mateusz Guzik 2022-11-22 12:28:07 +00:00
parent c1bfe8c593
commit 517547573a

View File

@ -1633,17 +1633,11 @@ crypto_freereq(struct cryptop *crp)
uma_zfree(cryptop_zone, crp);
}
static void
_crypto_initreq(struct cryptop *crp, crypto_session_t cses)
{
crp->crp_session = cses;
}
void
crypto_initreq(struct cryptop *crp, crypto_session_t cses)
{
memset(crp, 0, sizeof(*crp));
_crypto_initreq(crp, cses);
crp->crp_session = cses;
}
struct cryptop *
@ -1652,9 +1646,9 @@ crypto_getreq(crypto_session_t cses, int how)
struct cryptop *crp;
MPASS(how == M_WAITOK || how == M_NOWAIT);
crp = uma_zalloc(cryptop_zone, how | M_ZERO);
crp = uma_zalloc(cryptop_zone, how);
if (crp != NULL)
_crypto_initreq(crp, cses);
crypto_initreq(crp, cses);
return (crp);
}