1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-29 16:44:03 +00:00

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
This commit is contained in:
Andriy Gapon 2010-06-11 19:27:21 +00:00
parent 0301599d3d
commit 1bdfff2252
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209062
8 changed files with 10 additions and 12 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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

View File

@ -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,