From owner-svn-src-head@freebsd.org Tue Feb 14 18:34:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6942CCDEEA0; Tue, 14 Feb 2017 18:34:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3684B1FE9; Tue, 14 Feb 2017 18:34:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1EIYPcQ085101; Tue, 14 Feb 2017 18:34:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1EIYP4q085100; Tue, 14 Feb 2017 18:34:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702141834.v1EIYP4q085100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 14 Feb 2017 18:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313739 - head/sys/dev/iscsi 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.23 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, 14 Feb 2017 18:34:26 -0000 Author: mav Date: Tue Feb 14 18:34:25 2017 New Revision: 313739 URL: https://svnweb.freebsd.org/changeset/base/313739 Log: Directly call m_gethdr() instead of m_getm2() for BHS. All this code is based on assumption that data will be stored in one piece, and since buffer size if known and fixed, it is easier to hardcode it. MFC after: 2 weeks Modified: head/sys/dev/iscsi/icl_soft.c Modified: head/sys/dev/iscsi/icl_soft.c ============================================================================== --- head/sys/dev/iscsi/icl_soft.c Tue Feb 14 18:29:07 2017 (r313738) +++ head/sys/dev/iscsi/icl_soft.c Tue Feb 14 18:34:25 2017 (r313739) @@ -260,8 +260,8 @@ icl_soft_conn_new_pdu(struct icl_conn *i if (ip == NULL) return (NULL); - ip->ip_bhs_mbuf = m_getm2(NULL, sizeof(struct iscsi_bhs), - flags, MT_DATA, M_PKTHDR); + CTASSERT(sizeof(struct iscsi_bhs) <= MHLEN); + ip->ip_bhs_mbuf = m_gethdr(flags, MT_DATA); if (ip->ip_bhs_mbuf == NULL) { ICL_WARN("failed to allocate BHS mbuf"); icl_pdu_free(ip);