Skip to contentSkip to conversation

sg snprintf()s in 2.5.59

PATCH New Douglas Gilbert 1 participant 1 message Jan 30, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sg snprintf()s in 2.5.59

Patrick Mansfield reminded me that the attached patch hasn't made it into the 2.5 series yet. It's absence causes some corruption for long sg_driverfs_dev.name strings.

Doug Gilbert

drivers/scsi/sg.c2559snpr renamed from drivers/scsi/sg.c +3 -3
@@ -19,7 +19,7 @@
  */
 #include <linux/config.h>
 #ifdef CONFIG_PROC_FS
-static char *sg_version_str = "Version: 3.5.27 (20020812)";
+static char *sg_version_str = "Version: 3.5.27 (20030130)";
 #endif
 static int sg_version_num = 30527;	/* 2 digits for each component */
 /*
@@ -1455,9 +1455,9 @@
 	sdp->sg_tablesize = scsidp->host ? scsidp->host->sg_tablesize : 0;
 
 	memset(&sdp->sg_driverfs_dev, 0, sizeof (struct device));
-	sprintf(sdp->sg_driverfs_dev.bus_id, "%s:gen",
+	snprintf(sdp->sg_driverfs_dev.bus_id, BUS_ID_SIZE, "%s:gen",
 		scsidp->sdev_driverfs_dev.bus_id);
-	sprintf(sdp->sg_driverfs_dev.name, "%sgeneric",
+	snprintf(sdp->sg_driverfs_dev.name, DEVICE_NAME_SIZE, "%sgeneric",
 		scsidp->sdev_driverfs_dev.name);
 	sdp->sg_driverfs_dev.parent = &scsidp->sdev_driverfs_dev;
 	sdp->sg_driverfs_dev.bus = scsidp->sdev_driverfs_dev.bus;