From owner-svn-src-head@FreeBSD.ORG Tue Mar 11 01:41:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A56EED1D; Tue, 11 Mar 2014 01:41:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 92B93CC2; Tue, 11 Mar 2014 01:41:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2B1fAIv081646; Tue, 11 Mar 2014 01:41:10 GMT (envelope-from jmg@svn.freebsd.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2B1fACl081644; Tue, 11 Mar 2014 01:41:10 GMT (envelope-from jmg@svn.freebsd.org) Message-Id: <201403110141.s2B1fACl081644@svn.freebsd.org> From: John-Mark Gurney Date: Tue, 11 Mar 2014 01:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262993 - head/sys/opencrypto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Mar 2014 01:41:10 -0000 Author: jmg Date: Tue Mar 11 01:41:09 2014 New Revision: 262993 URL: http://svnweb.freebsd.org/changeset/base/262993 Log: 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 Modified: head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Tue Mar 11 01:10:44 2014 (r262992) +++ head/sys/opencrypto/cryptodev.c Tue Mar 11 01:41:09 2014 (r262993) @@ -1044,12 +1044,7 @@ csecreate(struct fcrypt *fcr, u_int64_t { 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); Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Tue Mar 11 01:10:44 2014 (r262992) +++ head/sys/opencrypto/cryptosoft.c Tue Mar 11 01:41:09 2014 (r262993) @@ -1003,7 +1003,7 @@ swcr_process(device_t dev, struct crypto 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) {