kernel: Pass a real format string to functions which expect one.
authorSascha Wildner <saw@online.de>
Wed, 4 Apr 2012 21:31:43 +0000 (23:31 +0200)
committerSascha Wildner <saw@online.de>
Wed, 4 Apr 2012 21:31:43 +0000 (23:31 +0200)
This is safer than just passing a random string.

A few of these changes might be overly cautious but it doesn't
hurt to stick with using formats where they are expected more
or less generally.

12 files changed:
sys/bus/usb/usb.c
sys/dev/acpica5/acpi_asus/acpi_asus.c
sys/dev/misc/dcons/dcons_os.c
sys/dev/netif/en_pci/if_en_pci.c
sys/dev/raid/aac/aac_debug.c
sys/dev/raid/twa/tw_cl_misc.c
sys/kern/kern_kthread.c
sys/kern/subr_bus.c
sys/kern/subr_disk.c
sys/kern/vfs_conf.c
sys/netinet/ip_divert.c
sys/vm/vm_zone.c

index 5669c20..49b0530 100644 (file)
@@ -358,7 +358,7 @@ usb_create_event_thread(device_t self)
                        taskq->name = taskq_names[i];
                        TAILQ_INIT(&taskq->tasks);
                        if (kthread_create(usb_task_thread, taskq,
-                           &taskq->task_thread_proc, taskq->name)) {
+                           &taskq->task_thread_proc, "%s", taskq->name)) {
                                kprintf("unable to create task thread\n");
                                panic("usb_create_event_thread task");
                        }
index d301616..14101a2 100644 (file)
@@ -715,7 +715,7 @@ good:
        sbuf_printf(sb, "Unsupported Asus laptop: %s\n", Obj->String.Pointer);
        sbuf_finish(sb);
 
-       device_printf(dev, sbuf_data(sb));
+       device_printf(dev, "%s", sbuf_data(sb));
 
        sbuf_delete(sb);
        AcpiOsFree(Buf.Pointer);
index 8fcd3af..95c7362 100644 (file)
@@ -570,8 +570,8 @@ dcons_attach_port(int port, char *name, int flags)
        ASSERT_LWKT_TOKEN_HELD(&tty_token);
        dc = &sc[port];
        dc->flags = flags;
-       dev = make_dev(&dcons_ops, port,
-                       UID_ROOT, GID_WHEEL, 0600, name);
+       dev = make_dev(&dcons_ops, port, UID_ROOT, GID_WHEEL, 0600, "%s",
+           name);
        dc->dev = (void *)dev;
        tp = ttymalloc(NULL);
 
index 35a61d0..a7693ea 100644 (file)
@@ -32,7 +32,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/pci/if_en_pci.c,v 1.12 1999/08/21 22:10:49 msmith Exp $
- * $DragonFly: src/sys/dev/netif/en_pci/if_en_pci.c,v 1.16 2007/07/11 23:46:58 dillon Exp $
  */
 
 /*
@@ -236,7 +235,8 @@ en_pci_attach(pcici_t config_id, int unit)
   en_cd.cd_devs[unit] = sc;            /* fake a cfdriver structure */
   en_cd.cd_ndevs = NEN;
   if_initname(&(sc->enif), "en", unit);
-  ksnprintf(sc->sc_dev.dv_xname, sizeof(sc->sc_dev.dv_xname), sc->enif.if_xname);
+  ksnprintf(sc->sc_dev.dv_xname, sizeof(sc->sc_dev.dv_xname), "%s",
+      sc->enif.if_xname);
   scp->en_confid = config_id;
 
   /*
index 7165419..e1168b7 100644 (file)
@@ -156,7 +156,7 @@ void
 aac_panic(struct aac_softc *sc, char *reason)
 {
        aac_print_queues(sc);
-       panic(reason);
+       panic("%s", reason);
 }
 
 /*
index 9b4e7f8..798e38a 100644 (file)
@@ -641,7 +641,7 @@ tw_cli_dbg_printf(TW_UINT8 dbg_level,
                va_end(ap);
 
                tw_osl_strcpy(print_str + tw_osl_strlen(print_str), "\n");
-               tw_osl_dbg_printf(ctlr_handle, print_str);
+               tw_osl_dbg_printf(ctlr_handle, "%s", print_str);
        }
 #endif /* TW_OSL_DEBUG */
 }
index 72d4806..71f7332 100644 (file)
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/kern/kern_kthread.c,v 1.5.2.3 2001/12/25 01:51:14 dillon Exp $
- * $DragonFly: src/sys/kern/kern_kthread.c,v 1.13 2006/12/18 20:41:01 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -164,7 +163,7 @@ kproc_start(const void *udata)
        int error;
 
        error = kthread_create((void (*)(void *))kp->func, NULL,
-                               kp->global_threadpp, kp->arg0);
+                               kp->global_threadpp, "%s", kp->arg0);
        lwkt_setpri(*kp->global_threadpp, TDPRI_KERN_DAEMON);
        if (error)
                panic("kproc_start: %s: error %d", kp->arg0, error);
index c9e1800..547e05e 100644 (file)
@@ -1682,7 +1682,7 @@ device_attach_async(device_t dev)
 
        atomic_add_int(&numasyncthreads, 1);
        lwkt_create(device_attach_thread, dev, &td, NULL,
-                   0, 0, (dev->desc ? dev->desc : "devattach"));
+                   0, 0, "%s", (dev->desc ? dev->desc : "devattach"));
 }
 
 static void
index acbc71b..78a37b6 100644 (file)
@@ -1381,7 +1381,7 @@ diskerr(struct bio *bio, cdev_t dev, const char *what, int pri, int donecnt)
 cdev_t
 disk_locate(const char *devname)
 {
-       return devfs_find_device_by_name(devname);
+       return devfs_find_device_by_name("%s", devname);
 }
 
 void
index de66f64..d0d33de 100644 (file)
@@ -604,7 +604,7 @@ kgetdiskbyname(const char *name)
        /*
         * Locate the device
         */
-       rdev = devfs_find_device_by_name(name);
+       rdev = devfs_find_device_by_name("%s", name);
        if (rdev == NULL) {
                kprintf("no disk named '%s'\n", name);
        }
index 7afaccc..c304c65 100644 (file)
@@ -222,7 +222,7 @@ div_packet(struct mbuf *m, int incoming, int port)
                 * this iface name will come along for the ride.
                 * (see div_output for the other half of this.)
                 */
-               ksnprintf(divsrc.sin_zero, sizeof divsrc.sin_zero,
+               ksnprintf(divsrc.sin_zero, sizeof divsrc.sin_zero, "%s",
                          m->m_pkthdr.rcvif->if_xname);
        }
 
index dcc59ec..68d2ebd 100644 (file)
@@ -702,7 +702,7 @@ zerror(int error)
                msg = "zone: invalid error";
                break;
        }
-       panic(msg);
+       panic("%s", msg);
 }
 #endif