From owner-svn-src-stable-10@FreeBSD.ORG Sat Sep 13 17:08:28 2014 Return-Path: Delivered-To: svn-src-stable-10@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 3A9ED9E9; Sat, 13 Sep 2014 17:08:28 +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 0B85AF78; Sat, 13 Sep 2014 17:08:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DH8RxG028190; Sat, 13 Sep 2014 17:08:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DH8R1M028188; Sat, 13 Sep 2014 17:08:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201409131708.s8DH8R1M028188@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 13 Sep 2014 17:08:27 +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: r271529 - 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-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 17:08:28 -0000 Author: mav Date: Sat Sep 13 17:08:27 2014 New Revision: 271529 URL: http://svnweb.freebsd.org/changeset/base/271529 Log: MFC r271362: Make ctl_port_mask an array to support more then 32 ports. Overflow reported by Coverity. CID: 1229894 Approved by: re (marius) Modified: stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Sat Sep 13 16:51:23 2014 (r271528) +++ stable/10/sys/cam/ctl/ctl_frontend.c Sat Sep 13 17:08:27 2014 (r271529) @@ -147,9 +147,9 @@ ctl_port_register(struct ctl_port *port, KASSERT(control_softc != NULL, ("CTL is not initialized")); mtx_lock(&control_softc->ctl_lock); - port_num = ctl_ffz(&control_softc->ctl_port_mask, CTL_MAX_PORTS); + port_num = ctl_ffz(control_softc->ctl_port_mask, CTL_MAX_PORTS); if ((port_num == -1) - || (ctl_set_mask(&control_softc->ctl_port_mask, port_num) == -1)) { + || (ctl_set_mask(control_softc->ctl_port_mask, port_num) == -1)) { port->targ_port = -1; mtx_unlock(&control_softc->ctl_lock); return (1); @@ -183,7 +183,7 @@ ctl_port_register(struct ctl_port *port, error: port->targ_port = -1; mtx_lock(&control_softc->ctl_lock); - ctl_clear_mask(&control_softc->ctl_port_mask, port_num); + ctl_clear_mask(control_softc->ctl_port_mask, port_num); mtx_unlock(&control_softc->ctl_lock); return (retval); } @@ -223,7 +223,7 @@ ctl_port_deregister(struct ctl_port *por control_softc->num_ports--; port_num = (port->targ_port < CTL_MAX_PORTS) ? port->targ_port : port->targ_port - CTL_MAX_PORTS; - ctl_clear_mask(&control_softc->ctl_port_mask, port_num); + ctl_clear_mask(control_softc->ctl_port_mask, port_num); control_softc->ctl_ports[port_num] = NULL; mtx_unlock(&control_softc->ctl_lock); Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Sat Sep 13 16:51:23 2014 (r271528) +++ stable/10/sys/cam/ctl/ctl_private.h Sat Sep 13 17:08:27 2014 (r271529) @@ -441,9 +441,9 @@ struct ctl_softc { struct ctl_io_pool *othersc_pool; struct proc *ctl_proc; int targ_online; - uint32_t ctl_lun_mask[CTL_MAX_LUNS >> 5]; + uint32_t ctl_lun_mask[(CTL_MAX_LUNS + 31) / 32]; struct ctl_lun *ctl_luns[CTL_MAX_LUNS]; - uint32_t ctl_port_mask; + uint32_t ctl_port_mask[(CTL_MAX_PORTS + 31) / 32]; uint64_t aps_locked_lun; STAILQ_HEAD(, ctl_lun) lun_list; STAILQ_HEAD(, ctl_be_lun) pending_lun_queue;