Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2017 20:26:42 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311305 - in head/sys: cam cam/ctl cam/scsi dev/aac dev/aacraid dev/advansys dev/aha dev/ahb dev/ahci dev/aic dev/aic7xxx dev/amr dev/arcmsr dev/ata dev/buslogic dev/ciss dev/dpt dev/es...
Message-ID:  <201701042026.v04KQggH076026@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Wed Jan  4 20:26:42 2017
New Revision: 311305
URL: https://svnweb.freebsd.org/changeset/base/311305

Log:
  Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)
  
  The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are
  fixed-length strings. AFAICT the only place they're read is in
  sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.
  However, the kernel doesn't null-terminate them. A bunch of copy-pasted code
  uses strncpy to write them, and doesn't guarantee null-termination. For at
  least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually
  overflows. You can see the result by doing "camcontrol negotiate da0 -v".
  
  This change null-terminates those fields everywhere they're set in the
  kernel. It also shortens a few strings to ensure they'll fit within the
  16-character field.
  
  PR:		215474
  Reported by:	Coverity
  CID:		1009997 1010000 1010001 1010002 1010003 1010004 1010005
  CID:		1331519 1010006 1215097 1010007 1288967 1010008 1306000
  CID:		1211924 1010009 1010010 1010011 1010012 1010013 1010014
  CID:		1147190 1010017 1010016 1010018 1216435 1010020 1010021
  CID:		1010022 1009666 1018185 1010023 1010025 1010026 1010027
  CID:		1010028 1010029 1010030 1010031 1010033 1018186 1018187
  CID:		1010035 1010036 1010042 1010041 1010040 1010039
  Reviewed by:	imp, sephe, slm
  MFC after:	4 weeks
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D9037
  Differential Revision:	https://reviews.freebsd.org/D9038

Modified:
  head/sys/cam/cam_xpt.c
  head/sys/cam/ctl/ctl_frontend_cam_sim.c
  head/sys/cam/scsi/scsi_low.c
  head/sys/dev/aac/aac_cam.c
  head/sys/dev/aacraid/aacraid_cam.c
  head/sys/dev/advansys/advansys.c
  head/sys/dev/advansys/adwcam.c
  head/sys/dev/aha/aha.c
  head/sys/dev/ahb/ahb.c
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahciem.c
  head/sys/dev/aic/aic.c
  head/sys/dev/aic7xxx/aic79xx_osm.c
  head/sys/dev/aic7xxx/aic7xxx_osm.c
  head/sys/dev/amr/amr_cam.c
  head/sys/dev/arcmsr/arcmsr.c
  head/sys/dev/ata/ata-all.c
  head/sys/dev/buslogic/bt.c
  head/sys/dev/ciss/ciss.c
  head/sys/dev/dpt/dpt_scsi.c
  head/sys/dev/esp/ncr53c9x.c
  head/sys/dev/firewire/sbp.c
  head/sys/dev/firewire/sbp_targ.c
  head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
  head/sys/dev/hptiop/hptiop.c
  head/sys/dev/hptmv/entry.c
  head/sys/dev/hptnr/hptnr_osm_bsd.c
  head/sys/dev/hptrr/hptrr_osm_bsd.c
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/iir/iir.c
  head/sys/dev/isci/isci_controller.c
  head/sys/dev/iscsi_initiator/isc_cam.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/mfi/mfi_cam.c
  head/sys/dev/mly/mly.c
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mpt/mpt_cam.c
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mvs/mvs.c
  head/sys/dev/ncr/ncr.c
  head/sys/dev/nvme/nvme_sim.c
  head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
  head/sys/dev/ppbus/vpo.c
  head/sys/dev/siis/siis.c
  head/sys/dev/sym/sym_hipd.c
  head/sys/dev/trm/trm.c
  head/sys/dev/twa/tw_osl_cam.c
  head/sys/dev/tws/tws_cam.c
  head/sys/dev/virtio/scsi/virtio_scsi.c
  head/sys/powerpc/ps3/ps3cdrom.c
  head/sys/powerpc/pseries/phyp_vscsi.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/cam/cam_xpt.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -5166,9 +5166,9 @@ xptaction(struct cam_sim *sim, union ccb
 		cpi->max_target = 0;
 		cpi->max_lun = 0;
 		cpi->initiator_id = 0;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "", HBA_IDLEN);
-		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "", HBA_IDLEN);
+		strlcpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
 		cpi->bus_id = sim->bus_id;
 		cpi->base_transfer_speed = 0;

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -773,9 +773,9 @@ cfcs_action(struct cam_sim *sim, union c
 		cpi->hpath_id = 0;
 		cpi->initiator_id = 0;
 
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = 0;
 		cpi->bus_id = 0;
 		cpi->base_transfer_speed = 800000;

Modified: head/sys/cam/scsi/scsi_low.c
==============================================================================
--- head/sys/cam/scsi/scsi_low.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/cam/scsi/scsi_low.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -722,9 +722,9 @@ settings_out:
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_SCSI;
 		cpi->protocol_version = SCSI_REV_2;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "SCSI_LOW", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "SCSI_LOW", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);

Modified: head/sys/dev/aac/aac_cam.c
==============================================================================
--- head/sys/dev/aac/aac_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/aac/aac_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -317,9 +317,9 @@ aac_cam_action(struct cam_sim *sim, unio
 		cpi->initiator_id = camsc->inf->InitiatorBusId;
 		cpi->bus_id = camsc->inf->BusNumber;
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->transport = XPORT_SPI;
 		cpi->transport_version = 2;

Modified: head/sys/dev/aacraid/aacraid_cam.c
==============================================================================
--- head/sys/dev/aacraid/aacraid_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/aacraid/aacraid_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1037,9 +1037,9 @@ aac_cam_action(struct cam_sim *sim, unio
 		cpi->transport_version = 0;
 		cpi->protocol_version = SCSI_REV_SPC2;
 #endif
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "PMC-Sierra", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "PMC-Sierra", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);

Modified: head/sys/dev/advansys/advansys.c
==============================================================================
--- head/sys/dev/advansys/advansys.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/advansys/advansys.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -429,9 +429,9 @@ adv_action(struct cam_sim *sim, union cc
 		cpi->initiator_id = adv->scsi_id;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Advansys", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Advansys", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->ccb_h.status = CAM_REQ_CMP;
                 cpi->transport = XPORT_SPI;

Modified: head/sys/dev/advansys/adwcam.c
==============================================================================
--- head/sys/dev/advansys/adwcam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/advansys/adwcam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -708,9 +708,9 @@ adw_action(struct cam_sim *sim, union cc
 		cpi->initiator_id = adw->initiator_id;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "AdvanSys", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "AdvanSys", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_SPI;
                 cpi->transport_version = 2;

Modified: head/sys/dev/aha/aha.c
==============================================================================
--- head/sys/dev/aha/aha.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/aha/aha.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -947,9 +947,9 @@ ahaaction(struct cam_sim *sim, union ccb
 		cpi->initiator_id = aha->scsi_id;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_SPI;
                 cpi->transport_version = 2;

Modified: head/sys/dev/ahb/ahb.c
==============================================================================
--- head/sys/dev/ahb/ahb.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ahb/ahb.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1178,9 +1178,9 @@ ahbaction(struct cam_sim *sim, union ccb
 		cpi->initiator_id = ahb->scsi_id;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_SPI;
                 cpi->transport_version = 2;

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ahci/ahci.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2687,9 +2687,9 @@ ahciaction(struct cam_sim *sim, union cc
 		cpi->initiator_id = 0;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "AHCI", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "AHCI", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->transport = XPORT_SATA;
 		cpi->transport_version = XPORT_VERSION_UNSPECIFIED;

Modified: head/sys/dev/ahci/ahciem.c
==============================================================================
--- head/sys/dev/ahci/ahciem.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ahci/ahciem.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -578,9 +578,9 @@ ahciemaction(struct cam_sim *sim, union 
 		cpi->initiator_id = 0;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "AHCI", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "AHCI", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->transport = XPORT_SATA;
 		cpi->transport_version = XPORT_VERSION_UNSPECIFIED;

Modified: head/sys/dev/aic/aic.c
==============================================================================
--- head/sys/dev/aic/aic.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/aic/aic.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -281,9 +281,9 @@ aic_action(struct cam_sim *sim, union cc
                 cpi->initiator_id = aic->initiator;
                 cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-                strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-                strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
-                strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+                strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+                strlcpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
+                strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
                 cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_SPI;
                 cpi->transport_version = 2;

Modified: head/sys/dev/aic7xxx/aic79xx_osm.c
==============================================================================
--- head/sys/dev/aic7xxx/aic79xx_osm.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/aic7xxx/aic79xx_osm.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -699,9 +699,9 @@ ahd_action(struct cam_sim *sim, union cc
 		}
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->protocol = PROTO_SCSI;
 		cpi->protocol_version = SCSI_REV_2;

Modified: head/sys/dev/aic7xxx/aic7xxx_osm.c
==============================================================================
--- head/sys/dev/aic7xxx/aic7xxx_osm.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/aic7xxx/aic7xxx_osm.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -797,9 +797,9 @@ ahc_action(struct cam_sim *sim, union cc
 		}
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->protocol = PROTO_SCSI;
 		cpi->protocol_version = SCSI_REV_2;

Modified: head/sys/dev/amr/amr_cam.c
==============================================================================
--- head/sys/dev/amr/amr_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/amr/amr_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -323,9 +323,9 @@ amr_cam_action(struct cam_sim *sim, unio
 		cpi->max_target = AMR_MAX_TARGETS;
 		cpi->max_lun = 0 /* AMR_MAX_LUNS*/;
 		cpi->initiator_id = 7;		  /* XXX variable? */
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "LSI", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "LSI", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 132 * 1024;  /* XXX */

Modified: head/sys/dev/arcmsr/arcmsr.c
==============================================================================
--- head/sys/dev/arcmsr/arcmsr.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/arcmsr/arcmsr.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2901,9 +2901,9 @@ static void arcmsr_action(struct cam_sim
 			cpi->max_lun = ARCMSR_MAX_TARGETLUN;	    /* 0-7 */
 			cpi->initiator_id = ARCMSR_SCSI_INITIATOR_ID; /* 255 */
 			cpi->bus_id = cam_sim_bus(psim);
-			strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-			strncpy(cpi->hba_vid, "ARCMSR", HBA_IDLEN);
-			strncpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
+			strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+			strlcpy(cpi->hba_vid, "ARCMSR", HBA_IDLEN);
+			strlcpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
 			cpi->unit_number = cam_sim_unit(psim);
 		#ifdef	CAM_NEW_TRAN_CODE
 			if(acb->adapter_bus_speed == ACB_BUS_SPEED_12G)

Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ata/ata-all.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1167,9 +1167,9 @@ ataaction(struct cam_sim *sim, union ccb
 			cpi->base_transfer_speed = 150000;
 		else
 			cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "ATA", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "ATA", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		if (ch->flags & ATA_SATA)
 			cpi->transport = XPORT_SATA;

Modified: head/sys/dev/buslogic/bt.c
==============================================================================
--- head/sys/dev/buslogic/bt.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/buslogic/bt.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1367,9 +1367,9 @@ btaction(struct cam_sim *sim, union ccb 
 		cpi->initiator_id = bt->scsi_id;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "BusLogic", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "BusLogic", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		cpi->transport = XPORT_SPI;

Modified: head/sys/dev/ciss/ciss.c
==============================================================================
--- head/sys/dev/ciss/ciss.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ciss/ciss.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -3026,9 +3026,9 @@ ciss_cam_action(struct cam_sim *sim, uni
 	cpi->max_target = sc->ciss_cfg->max_logical_supported;
 	cpi->max_lun = 0;		/* 'logical drive' channel only */
 	cpi->initiator_id = sc->ciss_cfg->max_logical_supported;
-	strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-        strncpy(cpi->hba_vid, "msmith@freebsd.org", HBA_IDLEN);
-        strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+	strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+        strlcpy(cpi->hba_vid, "CISS", HBA_IDLEN);
+        strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
         cpi->unit_number = cam_sim_unit(sim);
         cpi->bus_id = cam_sim_bus(sim);
 	cpi->base_transfer_speed = 132 * 1024;	/* XXX what to set this to? */

Modified: head/sys/dev/dpt/dpt_scsi.c
==============================================================================
--- head/sys/dev/dpt/dpt_scsi.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/dpt/dpt_scsi.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1027,9 +1027,9 @@ dpt_action(struct cam_sim *sim, union cc
 		cpi->initiator_id = dpt->hostid[cam_sim_bus(sim)];
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "DPT", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "DPT", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_SPI;
                 cpi->transport_version = 2;

Modified: head/sys/dev/esp/ncr53c9x.c
==============================================================================
--- head/sys/dev/esp/ncr53c9x.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/esp/ncr53c9x.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1013,9 +1013,9 @@ ncr53c9x_action(struct cam_sim *sim, uni
 		cpi->max_target = sc->sc_ntarg - 1;
 		cpi->max_lun = 7;
 		cpi->initiator_id = sc->sc_id;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "NCR", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "NCR", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->bus_id = 0;
 		cpi->base_transfer_speed = 3300;

Modified: head/sys/dev/firewire/sbp.c
==============================================================================
--- head/sys/dev/firewire/sbp.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/firewire/sbp.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2484,9 +2484,9 @@ END_DEBUG
 		cpi->initiator_id = SBP_INITIATOR;
 		cpi->bus_id = sim->bus_id;
 		cpi->base_transfer_speed = 400 * 1000 / 8;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "SBP", HBA_IDLEN);
-		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "SBP", HBA_IDLEN);
+		strlcpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
                 cpi->transport = XPORT_SPI;	/* XX should have a FireWire */
                 cpi->transport_version = 2;

Modified: head/sys/dev/firewire/sbp_targ.c
==============================================================================
--- head/sys/dev/firewire/sbp_targ.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/firewire/sbp_targ.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1331,9 +1331,9 @@ sbp_targ_action1(struct cam_sim *sim, un
 		cpi->initiator_id = 7; /* XXX */
 		cpi->bus_id = sim->bus_id;
 		cpi->base_transfer_speed = 400 * 1000 / 8;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "SBP_TARG", HBA_IDLEN);
-		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "SBP_TARG", HBA_IDLEN);
+		strlcpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
 
 		cpi->ccb_h.status = CAM_REQ_CMP;

Modified: head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
==============================================================================
--- head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -934,9 +934,9 @@ static void hpt_action(struct cam_sim *s
 		cpi->initiator_id = osm_max_targets;
 		cpi->base_transfer_speed = 3300;
 
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->transport = XPORT_SPI;
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/hptiop/hptiop.c
==============================================================================
--- head/sys/dev/hptiop/hptiop.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/hptiop/hptiop.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2365,9 +2365,9 @@ static void hptiop_action(struct cam_sim
 		cpi->initiator_id = hba->max_devices;
 		cpi->base_transfer_speed = 3300;
 
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->transport = XPORT_SPI;
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/hptmv/entry.c
==============================================================================
--- head/sys/dev/hptmv/entry.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/hptmv/entry.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2329,9 +2329,9 @@ hpt_action(struct cam_sim *sim, union cc
 
 			cpi->bus_id = cam_sim_bus(sim);
 			cpi->base_transfer_speed = 3300;
-			strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-			strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
-			strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+			strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+			strlcpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
+			strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 			cpi->unit_number = cam_sim_unit(sim);
 			cpi->transport = XPORT_SPI;
 			cpi->transport_version = 2;

Modified: head/sys/dev/hptnr/hptnr_osm_bsd.c
==============================================================================
--- head/sys/dev/hptnr/hptnr_osm_bsd.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/hptnr/hptnr_osm_bsd.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1134,9 +1134,9 @@ static void hpt_action(struct cam_sim *s
 		cpi->initiator_id = osm_max_targets;
 		cpi->base_transfer_speed = 3300;
 
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->transport = XPORT_SPI;
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c
==============================================================================
--- head/sys/dev/hptrr/hptrr_osm_bsd.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/hptrr/hptrr_osm_bsd.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -782,9 +782,9 @@ static void hpt_action(struct cam_sim *s
 		cpi->initiator_id = osm_max_targets;
 		cpi->base_transfer_speed = 3300;
 
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->transport = XPORT_SPI;
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -266,10 +266,10 @@ static const struct hyperv_guid gBlkVscD
 };
 
 static struct storvsc_driver_props g_drv_props_table[] = {
-	{"blkvsc", "Hyper-V IDE Storage Interface",
+	{"blkvsc", "Hyper-V IDE",
 	 BLKVSC_MAX_IDE_DISKS_PER_TARGET, BLKVSC_MAX_IO_REQUESTS,
 	 20*PAGE_SIZE},
-	{"storvsc", "Hyper-V SCSI Storage Interface",
+	{"storvsc", "Hyper-V SCSI",
 	 STORVSC_MAX_LUNS_PER_TARGET, STORVSC_MAX_IO_REQUESTS,
 	 20*PAGE_SIZE}
 };
@@ -1451,9 +1451,9 @@ storvsc_action(struct cam_sim *sim, unio
 		cpi->transport_version = 0;
 		cpi->protocol = PROTO_SCSI;
 		cpi->protocol_version = SCSI_REV_SPC2;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, sc->hs_drv_props->drv_name, HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, sc->hs_drv_props->drv_name, HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 
 		ccb->ccb_h.status = CAM_REQ_CMP;

Modified: head/sys/dev/iir/iir.c
==============================================================================
--- head/sys/dev/iir/iir.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/iir/iir.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1366,12 +1366,12 @@ iir_action( struct cam_sim *sim, union c
               cpi->initiator_id = 
                   (bus == gdt->sc_virt_bus ? 127 : gdt->sc_bus_id[bus]);
               cpi->base_transfer_speed = 3300;
-              strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+              strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
               if (gdt->sc_vendor == INTEL_VENDOR_ID_IIR)
-                  strncpy(cpi->hba_vid, "Intel Corp.", HBA_IDLEN);
+                  strlcpy(cpi->hba_vid, "Intel Corp.", HBA_IDLEN);
               else
-                  strncpy(cpi->hba_vid, "ICP vortex ", HBA_IDLEN);
-              strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+                  strlcpy(cpi->hba_vid, "ICP vortex ", HBA_IDLEN);
+              strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
               cpi->transport = XPORT_SPI;
               cpi->transport_version = 2;
               cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/isci/isci_controller.c
==============================================================================
--- head/sys/dev/isci/isci_controller.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/isci/isci_controller.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -691,9 +691,9 @@ void isci_action(struct cam_sim *sim, un
 			cpi->bus_id = bus;
 			cpi->initiator_id = SCI_MAX_REMOTE_DEVICES;
 			cpi->base_transfer_speed = 300000;
-			strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-			strncpy(cpi->hba_vid, "Intel Corp.", HBA_IDLEN);
-			strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+			strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+			strlcpy(cpi->hba_vid, "Intel Corp.", HBA_IDLEN);
+			strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 			cpi->transport = XPORT_SAS;
 			cpi->transport_version = 0;
 			cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/iscsi_initiator/isc_cam.c
==============================================================================
--- head/sys/dev/iscsi_initiator/isc_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/iscsi_initiator/isc_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -76,9 +76,9 @@ _inq(struct cam_sim *sim, union ccb *ccb
      cpi->max_lun = sp->opt.maxluns - 1;
      cpi->bus_id = cam_sim_bus(sim);
      cpi->base_transfer_speed = 3300; // 40000; // XXX:
-     strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-     strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN);
-     strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+     strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+     strlcpy(cpi->hba_vid, "iSCSI", HBA_IDLEN);
+     strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
      cpi->unit_number = cam_sim_unit(sim);
      cpi->ccb_h.status = CAM_REQ_CMP;
 #if defined(KNOB_VALID_ADDRESS)

Modified: head/sys/dev/isp/isp_freebsd.c
==============================================================================
--- head/sys/dev/isp/isp_freebsd.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/isp/isp_freebsd.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -4073,9 +4073,9 @@ isp_action(struct cam_sim *sim, union cc
 		}
 		cpi->protocol = PROTO_SCSI;
 		cpi->protocol_version = SCSI_REV_2;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Qlogic", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Qlogic", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);

Modified: head/sys/dev/mfi/mfi_cam.c
==============================================================================
--- head/sys/dev/mfi/mfi_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mfi/mfi_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -222,9 +222,9 @@ mfip_cam_action(struct cam_sim *sim, uni
 		cpi->max_target = MFI_SCSI_MAX_TARGETS;
 		cpi->max_lun = MFI_SCSI_MAX_LUNS;
 		cpi->initiator_id = MFI_SCSI_INITIATOR_ID;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "LSI", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "LSI", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;

Modified: head/sys/dev/mly/mly.c
==============================================================================
--- head/sys/dev/mly/mly.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mly/mly.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2109,9 +2109,9 @@ mly_cam_action(struct cam_sim *sim, unio
 	cpi->max_target = MLY_MAX_TARGETS - 1;
 	cpi->max_lun = MLY_MAX_LUNS - 1;
 	cpi->initiator_id = sc->mly_controllerparam->initiator_id;
-	strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-        strncpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN);
-        strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+	strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+        strlcpy(cpi->hba_vid, "Mylex", HBA_IDLEN);
+        strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
         cpi->unit_number = cam_sim_unit(sim);
         cpi->bus_id = cam_sim_bus(sim);
 	cpi->base_transfer_speed = 132 * 1024;	/* XXX what to set this to? */

Modified: head/sys/dev/mpr/mpr_sas.c
==============================================================================
--- head/sys/dev/mpr/mpr_sas.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mpr/mpr_sas.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -987,9 +987,9 @@ mprsas_action(struct cam_sim *sim, union
 		cpi->max_target = sassc->maxtargets - 1;
 		cpi->max_lun = 255;
 		cpi->initiator_id = sassc->maxtargets - 1;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Avago Tech (LSI)", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Avago Tech", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->bus_id = cam_sim_bus(sim);
 		/*

Modified: head/sys/dev/mps/mps_sas.c
==============================================================================
--- head/sys/dev/mps/mps_sas.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mps/mps_sas.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -943,9 +943,9 @@ mpssas_action(struct cam_sim *sim, union
 		cpi->max_target = sassc->maxtargets - 1;
 		cpi->max_lun = 255;
 		cpi->initiator_id = sassc->maxtargets - 1;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Avago Tech (LSI)", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Avago Tech", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;

Modified: head/sys/dev/mpt/mpt_cam.c
==============================================================================
--- head/sys/dev/mpt/mpt_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mpt/mpt_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -3583,9 +3583,9 @@ mpt_action(struct cam_sim *sim, union cc
 		} else {
 			cpi->target_sprt = 0;
 		}
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "LSI", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "LSI", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		break;

Modified: head/sys/dev/mrsas/mrsas_cam.c
==============================================================================
--- head/sys/dev/mrsas/mrsas_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mrsas/mrsas_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -356,9 +356,9 @@ mrsas_action(struct cam_sim *sim, union 
 			ccb->cpi.bus_id = cam_sim_bus(sim);
 			ccb->cpi.initiator_id = MRSAS_SCSI_INITIATOR_ID;
 			ccb->cpi.base_transfer_speed = 150000;
-			strncpy(ccb->cpi.sim_vid, "FreeBSD", SIM_IDLEN);
-			strncpy(ccb->cpi.hba_vid, "AVAGO", HBA_IDLEN);
-			strncpy(ccb->cpi.dev_name, cam_sim_name(sim), DEV_IDLEN);
+			strlcpy(ccb->cpi.sim_vid, "FreeBSD", SIM_IDLEN);
+			strlcpy(ccb->cpi.hba_vid, "AVAGO", HBA_IDLEN);
+			strlcpy(ccb->cpi.dev_name, cam_sim_name(sim), DEV_IDLEN);
 			ccb->cpi.transport = XPORT_SPI;
 			ccb->cpi.transport_version = 2;
 			ccb->cpi.protocol = PROTO_SCSI;

Modified: head/sys/dev/mvs/mvs.c
==============================================================================
--- head/sys/dev/mvs/mvs.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/mvs/mvs.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -2417,9 +2417,9 @@ mvsaction(struct cam_sim *sim, union ccb
 		cpi->initiator_id = 0;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Marvell", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Marvell", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->transport = XPORT_SATA;
 		cpi->transport_version = XPORT_VERSION_UNSPECIFIED;

Modified: head/sys/dev/ncr/ncr.c
==============================================================================
--- head/sys/dev/ncr/ncr.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ncr/ncr.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -4347,9 +4347,9 @@ ncr_action (struct cam_sim *sim, union c
 		cpi->initiator_id = np->myaddr;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Symbios", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Symbios", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_SPI;
                 cpi->transport_version = 2;

Modified: head/sys/dev/nvme/nvme_sim.c
==============================================================================
--- head/sys/dev/nvme/nvme_sim.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/nvme/nvme_sim.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -181,9 +181,9 @@ nvme_sim_action(struct cam_sim *sim, uni
 		cpi->initiator_id = 0;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 4000000;	/* 4 GB/s 4 lanes pcie 3 */
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "NVMe", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "NVMe", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
                 cpi->transport = XPORT_NVME;		/* XXX XPORT_PCIE ? */
                 cpi->transport_version = 1;		/* XXX Get PCIe spec ? */

Modified: head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
==============================================================================
--- head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1838,9 +1838,9 @@ static void agtiapi_cam_action( struct c
     cpi->max_lun = AGTIAPI_MAX_LUN;
     cpi->maxio = 1024 *1024; /* Max supported I/O size, in bytes. */
     cpi->initiator_id = 255;
-    strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-    strncpy(cpi->hba_vid, "PMC", HBA_IDLEN);
-    strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+    strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+    strlcpy(cpi->hba_vid, "PMC", HBA_IDLEN);
+    strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
     cpi->unit_number = cam_sim_unit(sim);
     cpi->bus_id = cam_sim_bus(sim);
     // rate is set when XPT_GET_TRAN_SETTINGS is processed

Modified: head/sys/dev/ppbus/vpo.c
==============================================================================
--- head/sys/dev/ppbus/vpo.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/ppbus/vpo.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -390,9 +390,9 @@ vpo_action(struct cam_sim *sim, union cc
 		cpi->initiator_id = VP0_INITIATOR;
 		cpi->bus_id = sim->bus_id;
 		cpi->base_transfer_speed = 93;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
-		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
+		strlcpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
 		cpi->transport = XPORT_PPB;
 		cpi->transport_version = 0;

Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/siis/siis.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -1959,9 +1959,9 @@ siisaction(struct cam_sim *sim, union cc
 		cpi->initiator_id = 0;
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "SIIS", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "SIIS", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->transport = XPORT_SATA;
 		cpi->transport_version = XPORT_VERSION_UNSPECIFIED;

Modified: head/sys/dev/sym/sym_hipd.c
==============================================================================
--- head/sys/dev/sym/sym_hipd.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/sym/sym_hipd.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -8047,9 +8047,9 @@ static void sym_action2(struct cam_sim *
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->initiator_id = np->myaddr;
 		cpi->base_transfer_speed = 3300;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Symbios", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Symbios", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 
 		cpi->protocol = PROTO_SCSI;

Modified: head/sys/dev/trm/trm.c
==============================================================================
--- head/sys/dev/trm/trm.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/trm/trm.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -651,9 +651,9 @@ trm_action(struct cam_sim *psim, union c
 			cpi->initiator_id = pACB->AdaptSCSIID;
 			cpi->bus_id = cam_sim_bus(psim);
 			cpi->base_transfer_speed = 3300;
-			strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-			strncpy(cpi->hba_vid, "Tekram_TRM", HBA_IDLEN);
-			strncpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
+			strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+			strlcpy(cpi->hba_vid, "Tekram_TRM", HBA_IDLEN);
+			strlcpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
 			cpi->unit_number = cam_sim_unit(psim);
 			cpi->transport = XPORT_SPI;
 			cpi->transport_version = 2;

Modified: head/sys/dev/twa/tw_osl_cam.c
==============================================================================
--- head/sys/dev/twa/tw_osl_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/twa/tw_osl_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -424,9 +424,9 @@ twa_action(struct cam_sim *sim, union cc
 		path_inq->bus_id = cam_sim_bus(sim);
 		path_inq->initiator_id = TW_CL_MAX_NUM_UNITS;
 		path_inq->base_transfer_speed = 100000;
-		strncpy(path_inq->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(path_inq->hba_vid, "3ware", HBA_IDLEN);
-		strncpy(path_inq->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(path_inq->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(path_inq->hba_vid, "3ware", HBA_IDLEN);
+		strlcpy(path_inq->dev_name, cam_sim_name(sim), DEV_IDLEN);
                 path_inq->transport = XPORT_SPI;
                 path_inq->transport_version = 2;
                 path_inq->protocol = PROTO_SCSI;

Modified: head/sys/dev/tws/tws_cam.c
==============================================================================
--- head/sys/dev/tws/tws_cam.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/tws/tws_cam.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -309,9 +309,9 @@ tws_action(struct cam_sim *sim, union cc
             ccb->cpi.bus_id = cam_sim_bus(sim);
             ccb->cpi.initiator_id = TWS_SCSI_INITIATOR_ID;
             ccb->cpi.base_transfer_speed = 6000000;
-            strncpy(ccb->cpi.sim_vid, "FreeBSD", SIM_IDLEN);
-            strncpy(ccb->cpi.hba_vid, "3ware", HBA_IDLEN);
-            strncpy(ccb->cpi.dev_name, cam_sim_name(sim), DEV_IDLEN);
+            strlcpy(ccb->cpi.sim_vid, "FreeBSD", SIM_IDLEN);
+            strlcpy(ccb->cpi.hba_vid, "3ware", HBA_IDLEN);
+            strlcpy(ccb->cpi.dev_name, cam_sim_name(sim), DEV_IDLEN);
 #if (__FreeBSD_version >= 700000 )
             ccb->cpi.transport = XPORT_SPI;
             ccb->cpi.transport_version = 2;

Modified: head/sys/dev/virtio/scsi/virtio_scsi.c
==============================================================================
--- head/sys/dev/virtio/scsi/virtio_scsi.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/dev/virtio/scsi/virtio_scsi.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -917,9 +917,9 @@ vtscsi_cam_path_inquiry(struct vtscsi_so
 	cpi->max_lun = sc->vtscsi_max_lun;
 	cpi->initiator_id = VTSCSI_INITIATOR_ID;
 
-	strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-	strncpy(cpi->hba_vid, "VirtIO", HBA_IDLEN);
-	strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+	strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+	strlcpy(cpi->hba_vid, "VirtIO", HBA_IDLEN);
+	strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 
 	cpi->unit_number = cam_sim_unit(sim);
 	cpi->bus_id = cam_sim_bus(sim);

Modified: head/sys/powerpc/ps3/ps3cdrom.c
==============================================================================
--- head/sys/powerpc/ps3/ps3cdrom.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/powerpc/ps3/ps3cdrom.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -420,9 +420,9 @@ ps3cdrom_action(struct cam_sim *sim, uni
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->base_transfer_speed = 150000;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Sony", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Sony", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->transport = XPORT_SPI;
 		cpi->transport_version = 2;
 		cpi->protocol = PROTO_SCSI;

Modified: head/sys/powerpc/pseries/phyp_vscsi.c
==============================================================================
--- head/sys/powerpc/pseries/phyp_vscsi.c	Wed Jan  4 19:53:04 2017	(r311304)
+++ head/sys/powerpc/pseries/phyp_vscsi.c	Wed Jan  4 20:26:42 2017	(r311305)
@@ -429,9 +429,9 @@ vscsi_cam_action(struct cam_sim *sim, un
 		cpi->max_target = 0;
 		cpi->max_lun = 0;
 		cpi->initiator_id = ~0;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "IBM", HBA_IDLEN);
-		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "IBM", HBA_IDLEN);
+		strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->bus_id = cam_sim_bus(sim);
 		cpi->base_transfer_speed = 150000;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701042026.v04KQggH076026>