aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-07-03 18:04:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:41 -0400
commit02aa2a37636c8fa4fb9322d91be46ff8225b7de0 (patch)
tree97c93d17cfcad186d229ef76f96de709eddfea8c /drivers/ide
parent096a8aac6bf4a5a0b2ef812ad76d056bbf3fb2af (diff)
drivers: avoid format string in dev_set_name
Calling dev_set_name with a single paramter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents, including wrappers like device_create*() and bdi_register(). Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/ide/ide-gd.c2
-rw-r--r--drivers/ide/ide-probe.c4
-rw-r--r--drivers/ide/ide-tape.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 2ff620444930..0b510bafd90e 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1756,7 +1756,7 @@ static int ide_cd_probe(ide_drive_t *drive)
1756 1756
1757 info->dev.parent = &drive->gendev; 1757 info->dev.parent = &drive->gendev;
1758 info->dev.release = ide_cd_release; 1758 info->dev.release = ide_cd_release;
1759 dev_set_name(&info->dev, dev_name(&drive->gendev)); 1759 dev_set_name(&info->dev, "%s", dev_name(&drive->gendev));
1760 1760
1761 if (device_register(&info->dev)) 1761 if (device_register(&info->dev))
1762 goto out_free_disk; 1762 goto out_free_disk;
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index de86631e767d..838996a0039e 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -392,7 +392,7 @@ static int ide_gd_probe(ide_drive_t *drive)
392 392
393 idkp->dev.parent = &drive->gendev; 393 idkp->dev.parent = &drive->gendev;
394 idkp->dev.release = ide_disk_release; 394 idkp->dev.release = ide_disk_release;
395 dev_set_name(&idkp->dev, dev_name(&drive->gendev)); 395 dev_set_name(&idkp->dev, "%s", dev_name(&drive->gendev));
396 396
397 if (device_register(&idkp->dev)) 397 if (device_register(&idkp->dev))
398 goto out_free_disk; 398 goto out_free_disk;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 068cef0a987a..2a744a91370e 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -545,7 +545,7 @@ static int ide_register_port(ide_hwif_t *hwif)
545 int ret; 545 int ret;
546 546
547 /* register with global device tree */ 547 /* register with global device tree */
548 dev_set_name(&hwif->gendev, hwif->name); 548 dev_set_name(&hwif->gendev, "%s", hwif->name);
549 dev_set_drvdata(&hwif->gendev, hwif); 549 dev_set_drvdata(&hwif->gendev, hwif);
550 if (hwif->gendev.parent == NULL) 550 if (hwif->gendev.parent == NULL)
551 hwif->gendev.parent = hwif->dev; 551 hwif->gendev.parent = hwif->dev;
@@ -559,7 +559,7 @@ static int ide_register_port(ide_hwif_t *hwif)
559 } 559 }
560 560
561 hwif->portdev = device_create(ide_port_class, &hwif->gendev, 561 hwif->portdev = device_create(ide_port_class, &hwif->gendev,
562 MKDEV(0, 0), hwif, hwif->name); 562 MKDEV(0, 0), hwif, "%s", hwif->name);
563 if (IS_ERR(hwif->portdev)) { 563 if (IS_ERR(hwif->portdev)) {
564 ret = PTR_ERR(hwif->portdev); 564 ret = PTR_ERR(hwif->portdev);
565 device_unregister(&hwif->gendev); 565 device_unregister(&hwif->gendev);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index c6c574bd5f59..1793aea4a7d2 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1985,7 +1985,7 @@ static int ide_tape_probe(ide_drive_t *drive)
1985 1985
1986 tape->dev.parent = &drive->gendev; 1986 tape->dev.parent = &drive->gendev;
1987 tape->dev.release = ide_tape_release; 1987 tape->dev.release = ide_tape_release;
1988 dev_set_name(&tape->dev, dev_name(&drive->gendev)); 1988 dev_set_name(&tape->dev, "%s", dev_name(&drive->gendev));
1989 1989
1990 if (device_register(&tape->dev)) 1990 if (device_register(&tape->dev))
1991 goto out_free_disk; 1991 goto out_free_disk;