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
This commit is contained in:
parent
801a8f9497
commit
1bf557366c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262993
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user