diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c index 34b4a9ef5875..8a992cc0ba74 100644 --- a/sys/cam/ctl/ctl_frontend.c +++ b/sys/cam/ctl/ctl_frontend.c @@ -147,9 +147,9 @@ ctl_port_register(struct ctl_port *port, int master_shelf) 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, int master_shelf) 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 *port) 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); diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index 5b23dad6433d..934aefd30dfe 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -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;