diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2015-09-15 12:58:51 -0500 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2015-10-20 11:50:15 -0500 |
commit | 82e938d40482c4204047485108b5c145c0101b29 (patch) | |
tree | 101889adc232b23df1e53f33e797fd42ce530dd7 /sys/opencrypto | |
parent | f64002f02d197d738df982cada3a82696430e136 (diff) | |
download | FreeBSD-src-82e938d40482c4204047485108b5c145c0101b29.zip FreeBSD-src-82e938d40482c4204047485108b5c145c0101b29.tar.gz |
MFC r262993:
some minor clean up.. Always _ZERO memory so mtx_init won't panic...
use the proper macro instead of hand rolling it...
Reviewed by: jhb (only the malloc change)
MFC after: 1 week
TAG: IPSEC-HEAD
Issue: #4841
Diffstat (limited to 'sys/opencrypto')
-rw-r--r-- | sys/opencrypto/cryptodev.c | 5 | ||||
-rw-r--r-- | sys/opencrypto/cryptosoft.c | 2 |
2 files changed, 1 insertions, 6 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 44bfa5c..5e949ca 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1044,12 +1044,7 @@ csecreate(struct fcrypt *fcr, u_int64_t sid, caddr_t key, u_int64_t keylen, { struct csession *cse; -#ifdef INVARIANTS - /* NB: required when mtx_init is built with INVARIANTS */ cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT | M_ZERO); -#else - cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT); -#endif if (cse == NULL) return NULL; mtx_init(&cse->lock, "cryptodev", "crypto session lock", MTX_DEF); diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 4095e89..a0875ff 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1003,7 +1003,7 @@ swcr_process(device_t dev, struct cryptop *crp, int hint) goto done; } - lid = crp->crp_sid & 0xffffffff; + lid = CRYPTO_SESID2LID(crp->crp_sid); rw_rlock(&swcr_sessions_lock); if (swcr_sessions == NULL || lid >= swcr_sesnum || lid == 0 || swcr_sessions[lid] == NULL) { |