From owner-svn-src-stable@FreeBSD.ORG Mon Oct 6 13:33:23 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05C5A6F5; Mon, 6 Oct 2014 13:33:23 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB5E3C28; Mon, 6 Oct 2014 13:33:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96DXMWm087484; Mon, 6 Oct 2014 13:33:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96DXMvL087483; Mon, 6 Oct 2014 13:33:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410061333.s96DXMvL087483@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 6 Oct 2014 13:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r272646 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 13:33:23 -0000 Author: mav Date: Mon Oct 6 13:33:22 2014 New Revision: 272646 URL: https://svnweb.freebsd.org/changeset/base/272646 Log: MFC r272247: Do not transfer unneeded training zero bytes in INQUIRY response. It is an addition to r269631. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 6 13:32:30 2014 (r272645) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 6 13:33:22 2014 (r272646) @@ -10482,7 +10482,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio struct ctl_softc *ctl_softc; struct ctl_lun *lun; char *val; - uint32_t alloc_len; + uint32_t alloc_len, data_len; ctl_port_type port_type; ctl_softc = control_softc; @@ -10506,16 +10506,17 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio * in. If the user only asks for less, we'll give him * that much. */ - ctsio->kern_data_ptr = malloc(sizeof(*inq_ptr), M_CTL, M_WAITOK | M_ZERO); + data_len = offsetof(struct scsi_inquiry_data, vendor_specific1); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); inq_ptr = (struct scsi_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; - if (sizeof(*inq_ptr) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*inq_ptr); - ctsio->kern_data_len = sizeof(*inq_ptr); - ctsio->kern_total_len = sizeof(*inq_ptr); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; } else { ctsio->residual = 0; ctsio->kern_data_len = alloc_len; @@ -10595,8 +10596,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio */ inq_ptr->response_format = SID_HiSup | 2; - inq_ptr->additional_length = - offsetof(struct scsi_inquiry_data, vendor_specific1) - + inq_ptr->additional_length = data_len - (offsetof(struct scsi_inquiry_data, additional_length) + 1); CTL_DEBUG_PRINT(("additional_length = %d\n", inq_ptr->additional_length));