Index: sys/cam/ata/ata_xpt.c =================================================================== --- sys/cam/ata/ata_xpt.c +++ sys/cam/ata/ata_xpt.c @@ -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); @@ -1490,9 +1490,9 @@ struct ccb_trans_settings cts; /* Report SIM that PM is absent. */ - bzero(&cts, sizeof(cts)); - xpt_setup_ccb(&cts.ccb_h, - work_ccb->ccb_h.path, CAM_PRIORITY_NONE); + 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; cts.xport_specific.sata.pm_present = 0; @@ -1694,8 +1694,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 @@ -1335,8 +1335,8 @@ 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 @@ -495,12 +495,6 @@ 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)); - /* * Create a path using the bus, target, and lun the * user passed in. @@ -514,8 +508,9 @@ break; } /* Ensure all of our fields are correct */ - xpt_setup_ccb(&ccb.ccb_h, ccb.ccb_h.path, - inccb->ccb_h.pinfo.priority); + xpt_setup_stack_ccb(&ccb.ccb_h, sizeof(ccb), + ccb.ccb_h.path, + inccb->ccb_h.pinfo.priority); xpt_merge_ccb(&ccb, inccb); xpt_action(&ccb); bcopy(&ccb, inccb, sizeof(union ccb)); @@ -1249,8 +1244,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 +2591,13 @@ if ((device->flags & CAM_DEV_UNCONFIGURED) != 0) return (1); - memset(&cgd, 0, sizeof(cgd)); 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); + 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); csa->callback(csa->callback_arg, @@ -5120,8 +5115,8 @@ 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 @@ -5146,8 +5141,8 @@ 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 @@ -5304,8 +5299,8 @@ 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 @@ -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,8 @@ 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)); if (length > 0) { - xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&nvmeio.ccb_h, sizeof(nvmeio), + 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, @@ -537,7 +537,8 @@ } /* Flush */ - xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_stack_ccb(&nvmeio.ccb_h, sizeof(nvmeio), periph->path, + CAM_PRIORITY_NORMAL); nvmeio.ccb_state = NDA_CCB_DUMP; nda_nvme_flush(softc, &nvmeio); 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,8 @@ 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,9 @@ 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; @@ -1097,8 +1097,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); 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); + xpt_setup_stack_ccb(&cdbg.ccb_h, sizeof(cdbg), 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); @@ -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,8 @@ 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 @@ -267,7 +267,7 @@ 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 @@ -215,7 +215,7 @@ 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; 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,8 @@ 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,8 @@ } 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,8 @@ } 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_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; 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,8 +3425,6 @@ if (sts != CAM_REQ_CMP) return; - bzero(&cts, sizeof(cts)); - #define cts__scsi (cts.proto_specific.scsi) #define cts__spi (cts.xport_specific.spi) @@ -3447,7 +3445,7 @@ cts__spi.ppr_options = tp->tinfo.current.options; #undef cts__spi #undef cts__scsi - xpt_setup_ccb(&cts.ccb_h, path, /*priority*/1); + xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, 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;