From owner-svn-src-all@FreeBSD.ORG Fri Jun 11 19:27:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40168106566B; Fri, 11 Jun 2010 19:27:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EE498FC15; Fri, 11 Jun 2010 19:27:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5BJRMs2067824; Fri, 11 Jun 2010 19:27:22 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5BJRLdX067815; Fri, 11 Jun 2010 19:27:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201006111927.o5BJRLdX067815@svn.freebsd.org> From: Andriy Gapon Date: Fri, 11 Jun 2010 19:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209062 - in head/sys: dev/acpica dev/usb fs/procfs geom kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jun 2010 19:27:22 -0000 Author: avg Date: Fri Jun 11 19:27:21 2010 New Revision: 209062 URL: http://svn.freebsd.org/changeset/base/209062 Log: 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 Modified: head/sys/dev/acpica/acpi_thermal.c head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_process.c head/sys/fs/procfs/procfs_type.c head/sys/geom/geom_dev.c head/sys/kern/subr_kdb.c head/sys/kern/subr_taskqueue.c Modified: head/sys/dev/acpica/acpi_thermal.c ============================================================================== --- head/sys/dev/acpica/acpi_thermal.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/dev/acpica/acpi_thermal.c Fri Jun 11 19:27:21 2010 (r209062) @@ -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 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); Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/dev/usb/usb_dev.c Fri Jun 11 19:27:21 2010 (r209062) @@ -1733,7 +1733,7 @@ usb_fifo_attach(struct usb_device *udev, /* 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; } Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/dev/usb/usb_device.c Fri Jun 11 19:27:21 2010 (r209062) @@ -1577,7 +1577,7 @@ usb_alloc_device(device_t parent_dev, st 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) { Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/dev/usb/usb_process.c Fri Jun 11 19:27:21 2010 (r209062) @@ -221,7 +221,7 @@ usb_proc_create(struct usb_process *up, 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; Modified: head/sys/fs/procfs/procfs_type.c ============================================================================== --- head/sys/fs/procfs/procfs_type.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/fs/procfs/procfs_type.c Fri Jun 11 19:27:21 2010 (r209062) @@ -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); } Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/geom/geom_dev.c Fri Jun 11 19:27:21 2010 (r209062) @@ -127,7 +127,7 @@ g_dev_taste(struct g_class *mp, struct g 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; Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/kern/subr_kdb.c Fri Jun 11 19:27:21 2010 (r209062) @@ -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 Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Fri Jun 11 19:17:36 2010 (r209061) +++ head/sys/kern/subr_taskqueue.c Fri Jun 11 19:27:21 2010 (r209062) @@ -322,7 +322,7 @@ taskqueue_start_threads(struct taskqueue 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,