summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-06-11 19:27:21 +0000
committeravg <avg@FreeBSD.org>2010-06-11 19:27:21 +0000
commit324886002f85f17304dae0b8970911d2c9f1a6f4 (patch)
tree2f7c2ec32c10d5bc3aea11e8861a695b7dd807b2
parenta674331779d7d47acd30342c7763589ace0b1fea (diff)
downloadFreeBSD-src-324886002f85f17304dae0b8970911d2c9f1a6f4.zip
FreeBSD-src-324886002f85f17304dae0b8970911d2c9f1a6f4.tar.gz
fix a few cases where a string is passed via format argument instead of
via %s Most of the cases looked harmless, but this is done for the sake of correctness. In one case it even allowed to drop an intermediate buffer. Found by: clang MFC after: 2 week
-rw-r--r--sys/dev/acpica/acpi_thermal.c6
-rw-r--r--sys/dev/usb/usb_dev.c2
-rw-r--r--sys/dev/usb/usb_device.c2
-rw-r--r--sys/dev/usb/usb_process.c2
-rw-r--r--sys/fs/procfs/procfs_type.c4
-rw-r--r--sys/geom/geom_dev.c2
-rw-r--r--sys/kern/subr_kdb.c2
-rw-r--r--sys/kern/subr_taskqueue.c2
8 files changed, 10 insertions, 12 deletions
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index 962fdb7..515a742 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -1171,7 +1171,6 @@ static int
acpi_tz_cooling_thread_start(struct acpi_tz_softc *sc)
{
int error;
- char name[16];
ACPI_LOCK(thermal);
if (sc->tz_cooling_proc_running) {
@@ -1182,10 +1181,9 @@ acpi_tz_cooling_thread_start(struct acpi_tz_softc *sc)
ACPI_UNLOCK(thermal);
error = 0;
if (sc->tz_cooling_proc == NULL) {
- snprintf(name, sizeof(name), "acpi_cooling%d",
- device_get_unit(sc->tz_dev));
error = kproc_create(acpi_tz_cooling_thread, sc,
- &sc->tz_cooling_proc, RFHIGHPID, 0, name);
+ &sc->tz_cooling_proc, RFHIGHPID, 0, "acpi_cooling%d",
+ device_get_unit(sc->tz_dev));
if (error != 0) {
device_printf(sc->tz_dev, "could not create thread - %d", error);
ACPI_LOCK(thermal);
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index 524890c..857d57a 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -1733,7 +1733,7 @@ usb_fifo_attach(struct usb_device *udev, void *priv_sc,
/* Now, create the device itself */
f_sc->dev = make_dev(&usb_devsw, 0, uid, gid, mode,
- devname);
+ "%s", devname);
/* XXX setting si_drv1 and creating the device is not atomic! */
f_sc->dev->si_drv1 = pd;
}
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index e9be466..62f59b8 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -1577,7 +1577,7 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus,
udev->ctrl_dev = usb_make_dev(udev, 0, FREAD|FWRITE);
/* Create a link from /dev/ugenX.X to the default endpoint */
- make_dev_alias(udev->ctrl_dev, udev->ugen_name);
+ make_dev_alias(udev->ctrl_dev, "%s", udev->ugen_name);
#endif
if (udev->flags.usb_mode == USB_MODE_HOST) {
diff --git a/sys/dev/usb/usb_process.c b/sys/dev/usb/usb_process.c
index 53461d2..d6915ba 100644
--- a/sys/dev/usb/usb_process.c
+++ b/sys/dev/usb/usb_process.c
@@ -221,7 +221,7 @@ usb_proc_create(struct usb_process *up, struct mtx *p_mtx,
cv_init(&up->up_drain, "usbdrain");
if (USB_THREAD_CREATE(&usb_process, up,
- &up->up_ptr, pmesg)) {
+ &up->up_ptr, "%s", pmesg)) {
DPRINTFN(0, "Unable to create USB process.");
up->up_ptr = NULL;
goto error;
diff --git a/sys/fs/procfs/procfs_type.c b/sys/fs/procfs/procfs_type.c
index c19bf9d..80cecc5 100644
--- a/sys/fs/procfs/procfs_type.c
+++ b/sys/fs/procfs/procfs_type.c
@@ -48,9 +48,9 @@ procfs_doproctype(PFS_FILL_ARGS)
static const char *none = "Not Available";
if (p != NULL && p->p_sysent && p->p_sysent->sv_name)
- sbuf_printf(sb, p->p_sysent->sv_name);
+ sbuf_printf(sb, "%s", p->p_sysent->sv_name);
else
- sbuf_printf(sb, none);
+ sbuf_printf(sb, "%s", none);
sbuf_putc(sb, '\n');
return (0);
}
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index b2d9d3b..173e326 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -127,7 +127,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
KASSERT(error == 0,
("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error));
dev = make_dev(&g_dev_cdevsw, 0,
- UID_ROOT, GID_OPERATOR, 0640, gp->name);
+ UID_ROOT, GID_OPERATOR, 0640, "%s", gp->name);
if (pp->flags & G_PF_CANDELETE)
dev->si_flags |= SI_CANDELETE;
dev->si_iosize_max = MAXPHYS;
diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
index 3e77db7..2a59503 100644
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -230,7 +230,7 @@ kdb_panic(const char *msg)
stop_cpus_hard(PCPU_GET(other_cpus));
#endif
printf("KDB: panic\n");
- panic(msg);
+ panic("%s", msg);
}
void
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c
index 8405b3d..205a23a 100644
--- a/sys/kern/subr_taskqueue.c
+++ b/sys/kern/subr_taskqueue.c
@@ -322,7 +322,7 @@ taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
for (i = 0; i < count; i++) {
if (count == 1)
error = kthread_add(taskqueue_thread_loop, tqp, NULL,
- &tq->tq_threads[i], RFSTOPPED, 0, ktname);
+ &tq->tq_threads[i], RFSTOPPED, 0, "%s", ktname);
else
error = kthread_add(taskqueue_thread_loop, tqp, NULL,
&tq->tq_threads[i], RFSTOPPED, 0,
OpenPOWER on IntegriCloud