Index: sys/cam/ata/ata_da.c =================================================================== --- sys/cam/ata/ata_da.c +++ sys/cam/ata/ata_da.c @@ -1119,9 +1119,9 @@ if ((periph->flags & CAM_PERIPH_INVALID) != 0) return (ENXIO); - memset(&ataio, 0, sizeof(ataio)); if (length > 0) { - xpt_setup_ccb(&ataio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&ataio.ccb_h, sizeof(ataio), periph->path, + CAM_PRIORITY_NORMAL); ataio.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&ataio, 0, @@ -1149,7 +1149,8 @@ } if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { - xpt_setup_ccb(&ataio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&ataio.ccb_h, sizeof(ataio), periph->path, + CAM_PRIORITY_NORMAL); /* * Tell the drive to flush its internal cache. if we @@ -1336,8 +1337,8 @@ case AC_GETDEV_CHANGED: { softc = (struct ada_softc *)periph->softc; - memset(&cgd, 0, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgd.ccb_h, sizeof(cgd), periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); @@ -1372,8 +1373,8 @@ cam_periph_async(periph, code, path, arg); if (softc->state != ADA_STATE_NORMAL) break; - memset(&cgd, 0, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgd.ccb_h, sizeof(cgd), periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) @@ -3613,8 +3614,8 @@ if (bootverbose) xpt_print(periph->path, "spin-down\n"); - memset(&local_ccb, 0, sizeof(local_ccb)); - xpt_setup_ccb(&local_ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&local_ccb.ccb_h, sizeof(local_ccb), + periph->path, CAM_PRIORITY_NORMAL); local_ccb.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&local_ccb, Index: sys/cam/ata/ata_pmp.c =================================================================== --- sys/cam/ata/ata_pmp.c +++ sys/cam/ata/ata_pmp.c @@ -444,8 +444,8 @@ if (xpt_create_path(&dpath, periph, xpt_path_path_id(periph->path), softc->pm_step, 0) == CAM_REQ_CMP) { - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, dpath, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), dpath, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -494,8 +494,8 @@ case PMP_STATE_PRECONFIG: /* Get/update host SATA capabilities. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), periph->path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); @@ -755,8 +755,8 @@ xpt_create_path(&dpath, periph, xpt_path_path_id(periph->path), softc->pm_step, 0) == CAM_REQ_CMP) { - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, dpath, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), + dpath, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.xport_specific.sata.revision = (res & 0x0f0) >> 4; Index: sys/cam/ata/ata_xpt.c =================================================================== --- sys/cam/ata/ata_xpt.c +++ sys/cam/ata/ata_xpt.c @@ -407,8 +407,8 @@ mode = 0; /* Fetch user modes from SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -430,8 +430,8 @@ /* Honor device capabilities. */ wantmode = mode = ata_max_mode(ident_buf, mode); /* Report modes to SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; if (path->device->transport == XPORT_ATA) { @@ -443,8 +443,8 @@ } xpt_action((union ccb *)&cts); /* Fetch current modes from SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); @@ -543,8 +543,8 @@ bytecount = 8192; /* SATA maximum */ /* Fetch user bytecount from SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -559,8 +559,8 @@ sectors = max(1, min(ident_buf->sectors_intr & 0xff, bytecount / ata_logical_sector_size(ident_buf))); /* Report bytecount to SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; if (path->device->transport == XPORT_ATA) { @@ -574,8 +574,8 @@ } xpt_action((union ccb *)&cts); /* Fetch current bytecount from SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); @@ -605,8 +605,8 @@ bytecount = 8192; /* SATA maximum */ /* Fetch user bytecount from SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -625,8 +625,8 @@ bytecount = min(8192, bytecount); } /* Report bytecount to SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; if (path->device->transport == XPORT_ATA) { @@ -726,8 +726,8 @@ { struct ccb_trans_settings cts; - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), periph->path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -867,8 +867,8 @@ } else if (sign == 0x9669 && done_ccb->ccb_h.target_id == 15) { /* Report SIM that PM is present. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.xport_specific.sata.pm_present = 1; @@ -1006,8 +1006,8 @@ if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_inquiry & PI_TAG_ABLE)) { /* Report SIM which tags are allowed. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), + path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.xport_specific.sata.tags = path->device->maxtags; @@ -1033,8 +1033,8 @@ goto out; case PROBE_SETMODE: /* Set supported bits. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); @@ -1054,8 +1054,8 @@ caps |= CTS_SATA_CAPS_D_APST; } /* Mask unwanted bits. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -1083,8 +1083,8 @@ if (path->device->inq_flags != oif) xpt_async(AC_GETDEV_CHANGED, path, NULL); /* Store result to SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; if (path->device->transport == XPORT_SATA) { @@ -1230,8 +1230,8 @@ if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) aproberequestdefaultnegotiation(periph); /* Set supported bits. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); @@ -1242,8 +1242,8 @@ /* All PMPs must support PM requests. */ caps |= CTS_SATA_CAPS_D_PMREQ; /* Mask unwanted bits. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -1258,8 +1258,8 @@ else path->device->inq_flags &= ~SID_AEN; /* Store result to SIM. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.xport_specific.sata.caps = caps; @@ -1490,8 +1490,7 @@ struct ccb_trans_settings cts; /* Report SIM that PM is absent. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), work_ccb->ccb_h.path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -1694,8 +1693,7 @@ ata_version(ident_buf->version_major) : cpi.transport_version; /* Tell the controller what we think */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.transport = path->device->transport; Index: sys/cam/cam_periph.c =================================================================== --- sys/cam/cam_periph.c +++ sys/cam/cam_periph.c @@ -750,7 +750,8 @@ switch (periph->deferred_ac) { case AC_FOUND_DEVICE: ccb.ccb_h.func_code = XPT_GDEV_TYPE; - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), + periph->path, CAM_PRIORITY_NORMAL); xpt_action(&ccb); arg = &ccb; break; @@ -1335,8 +1336,7 @@ CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_release_devq(%u, %u, %u, %d)\n", relsim_flags, openings, arg, getcount_only)); - memset(&crs, 0, sizeof(crs)); - xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&crs.ccb_h, sizeof(crs), path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = getcount_only ? CAM_DEV_QFREEZE : 0; crs.release_flags = relsim_flags; @@ -1459,8 +1459,8 @@ { struct ccb_getdevstats cgds; - memset(&cgds, 0, sizeof(cgds)); - xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgds.ccb_h, sizeof(cgds), periph->path, CAM_PRIORITY_NORMAL); cgds.ccb_h.func_code = XPT_GDEV_STATS; xpt_action((union ccb *)&cgds); cam_periph_freeze_after_event(periph, &cgds.last_reset, bus_settle); @@ -1531,10 +1531,8 @@ * First off, find out what the current * transaction counts are. */ - memset(&cgds, 0, sizeof(cgds)); - xpt_setup_ccb(&cgds.ccb_h, - ccb->ccb_h.path, - CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cgds.ccb_h, sizeof(cgds), ccb->ccb_h.path, + CAM_PRIORITY_NORMAL); cgds.ccb_h.func_code = XPT_GDEV_STATS; xpt_action((union ccb *)&cgds); @@ -1650,8 +1648,8 @@ /* * Grab the inquiry data for this device. */ - memset(&cgd, 0, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cgd.ccb_h, sizeof(cgd), ccb->ccb_h.path, + CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); Index: sys/cam/cam_xpt.c =================================================================== --- sys/cam/cam_xpt.c +++ sys/cam/cam_xpt.c @@ -494,18 +494,13 @@ case XPT_DEBUG: { union ccb ccb; - - /* - * This is an immediate CCB, so it's okay to - * allocate it on the stack. - */ - memset(&ccb, 0, sizeof(ccb)); + struct cam_path *path; /* * Create a path using the bus, target, and lun the * user passed in. */ - if (xpt_create_path(&ccb.ccb_h.path, NULL, + if (xpt_create_path(&path, NULL, inccb->ccb_h.path_id, inccb->ccb_h.target_id, inccb->ccb_h.target_lun) != @@ -513,13 +508,19 @@ error = EINVAL; break; } + + /* + * This is an immediate CCB, so it's okay to + * allocate it on the stack. + */ + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), path, + inccb->ccb_h.pinfo.priority); + /* Ensure all of our fields are correct */ - xpt_setup_ccb(&ccb.ccb_h, ccb.ccb_h.path, - inccb->ccb_h.pinfo.priority); xpt_merge_ccb(&ccb, inccb); xpt_action(&ccb); bcopy(&ccb, inccb, sizeof(union ccb)); - xpt_free_path(ccb.ccb_h.path); + xpt_free_path(path); break; } case XPT_DEV_MATCH: { @@ -1249,8 +1250,8 @@ xpt_path_assert(path, MA_OWNED); - memset(&cdai, 0, sizeof(cdai)); - xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cdai.ccb_h, sizeof(cdai), path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.flags = CDAI_FLAG_NONE; cdai.bufsiz = len; @@ -2596,13 +2597,13 @@ if ((device->flags & CAM_DEV_UNCONFIGURED) != 0) return (1); - memset(&cgd, 0, sizeof(cgd)); + xpt_setup_stack_ccb( + &cgd.ccb_h, sizeof(cgd), &path, CAM_PRIORITY_NORMAL); xpt_compile_path(&path, NULL, device->target->bus->path_id, device->target->target_id, device->lun_id); - xpt_setup_ccb(&cgd.ccb_h, &path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); csa->callback(csa->callback_arg, @@ -5125,8 +5126,7 @@ sim->max_tagged_dev_openings); xpt_dev_ccbq_resize(path, newopenings); xpt_async(AC_GETDEV_CHANGED, path, NULL); - memset(&crs, 0, sizeof(crs)); - xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&crs.ccb_h, sizeof(crs), path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; crs.openings @@ -5151,8 +5151,7 @@ device->inq_flags &= ~SID_CmdQue; xpt_dev_ccbq_resize(path, sim->max_dev_openings); xpt_async(AC_GETDEV_CHANGED, path, NULL); - memset(&crs, 0, sizeof(crs)); - xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&crs.ccb_h, sizeof(crs), path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; crs.openings @@ -5309,8 +5308,7 @@ xptpath = 1; } - memset(&csa, 0, sizeof(csa)); - xpt_setup_ccb(&csa.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), path, CAM_PRIORITY_NORMAL); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = event; csa.callback = cbfunc; Index: sys/cam/ctl/scsi_ctl.c =================================================================== --- sys/cam/ctl/scsi_ctl.c +++ sys/cam/ctl/scsi_ctl.c @@ -479,7 +479,8 @@ /*getcount_only*/1); } - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &ccb.ccb_h, sizeof(ccb), periph->path, CAM_PRIORITY_NONE); ccb.ccb_h.func_code = XPT_EN_LUN; ccb.cel.grp6_len = 0; ccb.cel.grp7_len = 0; @@ -613,7 +614,8 @@ cam_status status; /* Abort all ATIOs and INOTs queued to SIM. */ - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &ccb.ccb_h, sizeof(ccb), periph->path, CAM_PRIORITY_NONE); ccb.ccb_h.func_code = XPT_ABORT; LIST_FOREACH(hdr, &softc->atio_list, periph_links.le) { ccb.cab.abort_ccb = (union ccb *)hdr; @@ -1852,7 +1854,8 @@ struct ccb_getdevstats cgds; int num_items; - xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgds.ccb_h, sizeof(cgds), periph->path, CAM_PRIORITY_NORMAL); cgds.ccb_h.func_code = XPT_GDEV_STATS; xpt_action((union ccb *)&cgds); if ((cgds.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { Index: sys/cam/mmc/mmc_da.c =================================================================== --- sys/cam/mmc/mmc_da.c +++ sys/cam/mmc/mmc_da.c @@ -712,8 +712,8 @@ { CAM_DEBUG(path, CAM_DEBUG_TRACE, ("=> AC_GETDEV_CHANGED\n")); softc = (struct sdda_softc *)periph->softc; - memset(&cgd, 0, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgd.ccb_h, sizeof(cgd), periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); cam_periph_async(periph, code, path, arg); @@ -1565,8 +1565,8 @@ bioq_init(&part->bio_queue); - bzero(&cpi, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cpi.ccb_h, sizeof(cpi), periph->path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); Index: sys/cam/mmc/mmc_xpt.c =================================================================== --- sys/cam/mmc/mmc_xpt.c +++ sys/cam/mmc/mmc_xpt.c @@ -375,8 +375,7 @@ CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("mmc_announce_periph")); - memset(&cts, 0, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NORMAL); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb*)&cts); Index: sys/cam/nvme/nvme_da.c =================================================================== --- sys/cam/nvme/nvme_da.c +++ sys/cam/nvme/nvme_da.c @@ -523,9 +523,9 @@ return (ENXIO); /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ - memset(&nvmeio, 0, sizeof(nvmeio)); + xpt_setup_stack_ccb( + &nvmeio.ccb_h, sizeof(nvmeio), periph->path, CAM_PRIORITY_NORMAL); if (length > 0) { - xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); nvmeio.ccb_state = NDA_CCB_DUMP; nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, @@ -536,9 +536,6 @@ return (error); } - /* Flush */ - xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); - nvmeio.ccb_state = NDA_CCB_DUMP; nda_nvme_flush(softc, &nvmeio); error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, Index: sys/cam/nvme/nvme_xpt.c =================================================================== --- sys/cam/nvme/nvme_xpt.c +++ sys/cam/nvme/nvme_xpt.c @@ -634,8 +634,7 @@ path->device->protocol_version = cpi.protocol_version; /* Tell the controller what we think */ - memset(&cts, 0, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.transport = path->device->transport; @@ -793,8 +792,7 @@ cam_periph_assert(periph, MA_OWNED); /* Ask the SIM for connection details */ - memset(&cts, 0, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NORMAL); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb*)&cts); Index: sys/cam/scsi/scsi_cd.c =================================================================== --- sys/cam/scsi/scsi_cd.c +++ sys/cam/scsi/scsi_cd.c @@ -1259,10 +1259,8 @@ status = done_ccb->ccb_h.status; - bzero(&cgd, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, - done_ccb->ccb_h.path, - CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cgd.ccb_h, sizeof(cgd), + done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); Index: sys/cam/scsi/scsi_enc_ses.c =================================================================== --- sys/cam/scsi/scsi_enc_ses.c +++ sys/cam/scsi/scsi_enc_ses.c @@ -974,8 +974,8 @@ != CAM_REQ_CMP) return; - memset(&cgd, 0, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgd.ccb_h, sizeof(cgd), path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); if (cgd.ccb_h.status == CAM_REQ_CMP) @@ -1036,8 +1036,8 @@ args = (ses_setphyspath_callback_args_t *)arg; old_physpath = malloc(MAXPATHLEN, M_SCSIENC, M_WAITOK|M_ZERO); xpt_path_lock(path); - memset(&cdai, 0, sizeof(cdai)); - xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cdai.ccb_h, sizeof(cdai), path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; cdai.flags = CDAI_FLAG_NONE; @@ -1048,7 +1048,8 @@ cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); if (strcmp(old_physpath, sbuf_data(args->physpath)) != 0) { - xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cdai.ccb_h, sizeof(cdai), path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; cdai.flags = CDAI_FLAG_STORE; @@ -1097,8 +1098,8 @@ * Assemble the components of the physical path starting with * the device ID of the enclosure itself. */ - memset(&cdai, 0, sizeof(cdai)); - xpt_setup_ccb(&cdai.ccb_h, enc->periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cdai.ccb_h, sizeof(cdai), enc->periph->path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.flags = CDAI_FLAG_NONE; cdai.buftype = CDAI_TYPE_SCSI_DEVID; Index: sys/cam/scsi/scsi_sa.c =================================================================== --- sys/cam/scsi/scsi_sa.c +++ sys/cam/scsi/scsi_sa.c @@ -2403,8 +2403,8 @@ bzero(&ext_inq, sizeof(ext_inq)); - memset(&cdai, 0, sizeof(cdai)); - xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cdai.ccb_h, sizeof(cdai), periph->path, + CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.flags = CDAI_FLAG_NONE; @@ -4417,10 +4417,8 @@ SASBADDVARSTR(sb, indent, periph->periph_name, %s, periph_name, strlen(periph->periph_name) + 1); SASBADDUINT(sb, indent, periph->unit_number, %u, unit_number); - memset(&cgd, 0, sizeof(cgd)); - xpt_setup_ccb(&cgd.ccb_h, - periph->path, - CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cgd.ccb_h, sizeof(cgd), periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); if ((cgd.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { Index: sys/cam/scsi/scsi_targ_bh.c =================================================================== --- sys/cam/scsi/scsi_targ_bh.c +++ sys/cam/scsi/scsi_targ_bh.c @@ -241,7 +241,8 @@ if ((softc->flags & TARGBH_FLAG_LUN_ENABLED) != 0) return (CAM_REQ_CMP); - xpt_setup_ccb(&immed_ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&immed_ccb.ccb_h, sizeof(immed_ccb), periph->path, + CAM_PRIORITY_NORMAL); immed_ccb.ccb_h.func_code = XPT_EN_LUN; /* Don't need support for any vendor specific commands */ Index: sys/cam/scsi/scsi_target.c =================================================================== --- sys/cam/scsi/scsi_target.c +++ sys/cam/scsi/scsi_target.c @@ -272,12 +272,12 @@ status = CAM_DEV_NOT_THERE; break; } - bzero(&cdbg, sizeof cdbg); + xpt_setup_stack_ccb(&cdbg.ccb_h, sizeof(cdbg), softc->path, + CAM_PRIORITY_NORMAL); if (*((int *)addr) != 0) cdbg.flags = CAM_DEBUG_PERIPH; else cdbg.flags = CAM_DEBUG_NONE; - xpt_setup_ccb(&cdbg.ccb_h, softc->path, CAM_PRIORITY_NORMAL); cdbg.ccb_h.func_code = XPT_DEBUG; cdbg.ccb_h.cbfcnp = targdone; xpt_action((union ccb *)&cdbg); @@ -363,7 +363,8 @@ cam_status status; /* Tell the lun to begin answering selects */ - xpt_setup_ccb(&en_ccb.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &en_ccb.ccb_h, sizeof(en_ccb), path, CAM_PRIORITY_NORMAL); en_ccb.ccb_h.func_code = XPT_EN_LUN; /* Don't need support for any vendor specific commands */ en_ccb.grp6_len = grp6_len; @@ -1033,7 +1034,8 @@ * Then abort all pending CCBs. * targdone() will return the aborted CCB via user_ccb_queue */ - xpt_setup_ccb(&cab.ccb_h, softc->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cab.ccb_h, sizeof(cab), softc->path, CAM_PRIORITY_NORMAL); cab.ccb_h.func_code = XPT_ABORT; cab.ccb_h.status = CAM_REQ_CMP_ERR; TAILQ_FOREACH(ccb_h, &softc->pending_ccb_queue, periph_links.tqe) { Index: sys/cam/scsi/scsi_xpt.c =================================================================== --- sys/cam/scsi/scsi_xpt.c +++ sys/cam/scsi/scsi_xpt.c @@ -1036,8 +1036,8 @@ { struct ccb_trans_settings cts; - memset(&cts, 0, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), periph->path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); @@ -1058,8 +1058,8 @@ struct ccb_trans_settings cts; struct ccb_trans_settings_spi *spi; - memset(&cts, 0, sizeof (cts)); - xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), periph->path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); @@ -2303,8 +2303,7 @@ CAM_DEBUG(path, CAM_DEBUG_TRACE, ("scsi_scan_lun\n")); - memset(&cpi, 0, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -2430,8 +2429,7 @@ struct scsi_inquiry_data *inq_buf; /* Get transport information from the SIM */ - memset(&cpi, 0, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -2491,8 +2489,7 @@ */ /* Tell the controller what we think */ - memset(&cts, 0, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.transport = path->device->transport; @@ -2748,8 +2745,7 @@ inq_data = &device->inq_data; scsi = &cts->proto_specific.scsi; - memset(&cpi, 0, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -2770,8 +2766,8 @@ * Perform sanity checking against what the * controller and device can do. */ - memset(&cur_cts, 0, sizeof(cur_cts)); - xpt_setup_ccb(&cur_cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cur_cts.ccb_h, sizeof(cur_cts), path, CAM_PRIORITY_NONE); cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cur_cts.type = cts->type; xpt_action((union ccb *)&cur_cts); @@ -2954,8 +2950,8 @@ && (dev->inq_flags & (SID_Sync|SID_WBus16|SID_WBus32)) != 0)) { struct ccb_trans_settings cts; - memset(&cts, 0, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + xpt_setup_stack_ccb( + &cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); cts.protocol = PROTO_SCSI; cts.protocol_version = PROTO_VERSION_UNSPECIFIED; cts.transport = XPORT_UNSPECIFIED; @@ -3062,8 +3058,7 @@ return; /* Ask the SIM for its base transfer speed */ - memset(&cpi, 0, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); Index: sys/dev/aic7xxx/aic79xx_osm.c =================================================================== --- sys/dev/aic7xxx/aic79xx_osm.c +++ sys/dev/aic7xxx/aic79xx_osm.c @@ -266,8 +266,8 @@ sim = NULL; goto fail; } - - xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5); + + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; csa.callback = ahd_async; Index: sys/dev/aic7xxx/aic7xxx_osm.c =================================================================== --- sys/dev/aic7xxx/aic7xxx_osm.c +++ sys/dev/aic7xxx/aic7xxx_osm.c @@ -214,8 +214,8 @@ sim = NULL; goto fail; } - - xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5); + + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; csa.callback = ahc_async; @@ -256,7 +256,7 @@ sim2 = NULL; goto fail; } - xpt_setup_ccb(&csa.ccb_h, path2, /*priority*/5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), path2, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; csa.callback = ahc_async; Index: sys/dev/arcmsr/arcmsr.c =================================================================== --- sys/dev/arcmsr/arcmsr.c +++ sys/dev/arcmsr/arcmsr.c @@ -4957,7 +4957,7 @@ /* **************************************************** */ - xpt_setup_ccb(&csa.ccb_h, acb->ppath, /*priority*/5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), acb->ppath, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE|AC_LOST_DEVICE; csa.callback = arcmsr_async; Index: sys/dev/hpt27xx/hpt27xx_osm_bsd.c =================================================================== --- sys/dev/hpt27xx/hpt27xx_osm_bsd.c +++ sys/dev/hpt27xx/hpt27xx_osm_bsd.c @@ -1252,7 +1252,7 @@ return ; } - xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), vbus_ext->path, 5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = AC_LOST_DEVICE; ccb.callback = hpt_async; Index: sys/dev/hptiop/hptiop.c =================================================================== --- sys/dev/hptiop/hptiop.c +++ sys/dev/hptiop/hptiop.c @@ -2046,7 +2046,7 @@ goto free_hba_path; } - xpt_setup_ccb(&ccb.ccb_h, hba->path, /*priority*/5); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), hba->path, 5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = (AC_FOUND_DEVICE | AC_LOST_DEVICE); ccb.callback = hptiop_async; @@ -2797,7 +2797,7 @@ if (hba->path) { struct ccb_setasync ccb; - xpt_setup_ccb(&ccb.ccb_h, hba->path, /*priority*/5); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), hba->path, 5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = 0; ccb.callback = hptiop_async; Index: sys/dev/hptnr/hptnr_osm_bsd.c =================================================================== --- sys/dev/hptnr/hptnr_osm_bsd.c +++ sys/dev/hptnr/hptnr_osm_bsd.c @@ -1438,7 +1438,7 @@ } hpt_unlock_vbus(vbus_ext); - xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), vbus_ext->path, 5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = AC_LOST_DEVICE; ccb.callback = hpt_async; Index: sys/dev/hptrr/hptrr_osm_bsd.c =================================================================== --- sys/dev/hptrr/hptrr_osm_bsd.c +++ sys/dev/hptrr/hptrr_osm_bsd.c @@ -1086,7 +1086,7 @@ } hpt_unlock_vbus(vbus_ext); - xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), vbus_ext->path, 5); ccb.ccb_h.func_code = XPT_SASYNC_CB; ccb.event_enable = AC_LOST_DEVICE; ccb.callback = hpt_async; Index: sys/dev/isci/isci_io_request.c =================================================================== --- sys/dev/isci/isci_io_request.c +++ sys/dev/isci/isci_io_request.c @@ -186,7 +186,8 @@ cam_sim_path(isci_controller->sim), isci_remote_device->index, 0); - xpt_setup_ccb(&ccb_relsim.ccb_h, path, 5); + xpt_setup_stack_ccb( + &ccb_relsim.ccb_h, sizeof(ccb_relsim), path, 5); ccb_relsim.ccb_h.func_code = XPT_REL_SIMQ; ccb_relsim.ccb_h.flags = CAM_DEV_QFREEZE; ccb_relsim.release_flags = RELSIM_ADJUST_OPENINGS; Index: sys/dev/mpr/mpr_sas.c =================================================================== --- sys/dev/mpr/mpr_sas.c +++ sys/dev/mpr/mpr_sas.c @@ -3358,7 +3358,8 @@ } bzero(&rcap_buf, sizeof(rcap_buf)); - xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cdai.ccb_h, sizeof(cdai), path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.ccb_h.flags = CAM_DIR_IN; cdai.buftype = CDAI_TYPE_RCAPLONG; Index: sys/dev/mps/mps_sas.c =================================================================== --- sys/dev/mps/mps_sas.c +++ sys/dev/mps/mps_sas.c @@ -3204,7 +3204,8 @@ } bzero(&rcap_buf, sizeof(rcap_buf)); - xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb( + &cdai.ccb_h, sizeof(cdai), path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.ccb_h.flags = CAM_DIR_IN; cdai.buftype = CDAI_TYPE_RCAPLONG; Index: sys/dev/mpt/mpt_cam.c =================================================================== --- sys/dev/mpt/mpt_cam.c +++ sys/dev/mpt/mpt_cam.c @@ -2448,7 +2448,8 @@ "XPT_REL_SIMQ"); break; } - xpt_setup_ccb(&crs.ccb_h, tmppath, 5); + xpt_setup_stack_ccb( + &crs.ccb_h, sizeof(crs), tmppath, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; crs.release_flags = RELSIM_ADJUST_OPENINGS; Index: sys/dev/mpt/mpt_raid.c =================================================================== --- sys/dev/mpt/mpt_raid.c +++ sys/dev/mpt/mpt_raid.c @@ -296,7 +296,7 @@ goto cleanup; } - xpt_setup_ccb(&csa.ccb_h, mpt->path, 5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), mpt->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE; csa.callback = mpt_raid_async; @@ -336,7 +336,7 @@ handler.reply_handler = mpt_raid_reply_handler; mpt_deregister_handler(mpt, MPT_HANDLER_REPLY, handler, raid_handler_id); - xpt_setup_ccb(&csa.ccb_h, mpt->path, /*priority*/5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), mpt->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; csa.callback = mpt_raid_async; @@ -1071,7 +1071,7 @@ { struct ccb_relsim crs; - xpt_setup_ccb(&crs.ccb_h, path, /*priority*/5); + xpt_setup_stack_ccb(&crs.ccb_h, sizeof(crs), path, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; crs.release_flags = RELSIM_ADJUST_OPENINGS; Index: sys/dev/pms/freebsd/driver/ini/src/agtiapi.c =================================================================== --- sys/dev/pms/freebsd/driver/ini/src/agtiapi.c +++ sys/dev/pms/freebsd/driver/ini/src/agtiapi.c @@ -470,7 +470,7 @@ void agtiapi_adjust_queue_depth(struct cam_path *path, bit32 QueueDepth) { struct ccb_relsim crs; - xpt_setup_ccb(&crs.ccb_h, path, 5); + xpt_setup_stack_ccb(&crs.ccb_h, sizeof(crs), path, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; crs.release_flags = RELSIM_ADJUST_OPENINGS; @@ -929,7 +929,7 @@ return( EIO ); } pmsc->path = ccb->ccb_h.path; - xpt_setup_ccb(&csa.ccb_h, pmsc->path, 5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), pmsc->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE; csa.callback = agtiapi_async; @@ -6545,14 +6545,14 @@ if (pCard->sim != NULL) { mtx_lock(&thisCardInst->pmIOLock); - xpt_setup_ccb(&csa.ccb_h, pCard->path, 5); - csa.ccb_h.func_code = XPT_SASYNC_CB; - csa.event_enable = 0; - csa.callback = agtiapi_async; - csa.callback_arg = pCard; - xpt_action((union ccb *)&csa); - xpt_free_path(pCard->path); - // if (pCard->ccbTotal == 0) + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), pCard->path, 5); + csa.ccb_h.func_code = XPT_SASYNC_CB; + csa.event_enable = 0; + csa.callback = agtiapi_async; + csa.callback_arg = pCard; + xpt_action((union ccb *)&csa); + xpt_free_path(pCard->path); + // if (pCard->ccbTotal == 0) if (pCard->ccbTotal <= thisCard) { /* Index: sys/dev/smartpqi/smartpqi_cam.c =================================================================== --- sys/dev/smartpqi/smartpqi_cam.c +++ sys/dev/smartpqi/smartpqi_cam.c @@ -1026,7 +1026,7 @@ DBG_INFO("IN\n"); - xpt_setup_ccb(&crs.ccb_h, path, 5); + xpt_setup_stack_ccb(&crs.ccb_h, sizeof(crs), path, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; crs.release_flags = RELSIM_ADJUST_OPENINGS; @@ -1144,7 +1144,8 @@ * derived from the FW. */ softs->os_specific.path = ccb->ccb_h.path; - xpt_setup_ccb(&csa.ccb_h, softs->os_specific.path, 5); + xpt_setup_stack_ccb( + &csa.ccb_h, sizeof(csa), softs->os_specific.path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE; csa.callback = smartpqi_async; @@ -1173,7 +1174,8 @@ mtx_lock(&softs->os_specific.cam_lock); } - xpt_setup_ccb(&csa.ccb_h, softs->os_specific.path, 5); + xpt_setup_stack_ccb( + &csa.ccb_h, sizeof(csa), softs->os_specific.path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; csa.callback = smartpqi_async; Index: sys/dev/sym/sym_hipd.c =================================================================== --- sys/dev/sym/sym_hipd.c +++ sys/dev/sym/sym_hipd.c @@ -3425,7 +3425,7 @@ if (sts != CAM_REQ_CMP) return; - bzero(&cts, sizeof(cts)); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, 1); #define cts__scsi (cts.proto_specific.scsi) #define cts__spi (cts.xport_specific.spi) @@ -3447,7 +3447,6 @@ cts__spi.ppr_options = tp->tinfo.current.options; #undef cts__spi #undef cts__scsi - xpt_setup_ccb(&cts.ccb_h, path, /*priority*/1); xpt_async(AC_TRANSFER_NEG, path, &cts); xpt_free_path(path); } Index: sys/dev/virtio/scsi/virtio_scsi.c =================================================================== --- sys/dev/virtio/scsi/virtio_scsi.c +++ sys/dev/virtio/scsi/virtio_scsi.c @@ -700,8 +700,7 @@ { struct ccb_setasync csa; - memset(&csa, 0, sizeof(csa)); - xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE | AC_FOUND_DEVICE; csa.callback = vtscsi_cam_async; @@ -717,8 +716,7 @@ { struct ccb_setasync csa; - memset(&csa, 0, sizeof(csa)); - xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; csa.callback = vtscsi_cam_async; Index: sys/powerpc/ps3/ps3cdrom.c =================================================================== --- sys/powerpc/ps3/ps3cdrom.c +++ sys/powerpc/ps3/ps3cdrom.c @@ -262,7 +262,7 @@ goto fail_unregister_xpt_bus; } - xpt_setup_ccb(&csa.ccb_h, sc->sc_path, 5); + xpt_setup_stack_ccb(&csa.ccb_h, sizeof(csa), sc->sc_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; csa.callback = ps3cdrom_async;