lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1245203150.21602.10.camel@pasglop>
Date:	Wed, 17 Jun 2009 11:45:50 +1000
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Greg KH <greg@...ah.com>
Cc:	Linux Kernel list <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] driver/core: Fix various warnings due to dev_set_name()
 usage

gcc is too smart, we get:

drivers/base/core.c: In function ‘device_add’:
drivers/base/core.c:877: warning: format not a string literal and no format arguments
drivers/base/core.c: In function ‘__root_device_register’:
drivers/base/core.c:1274: warning: format not a string literal and no format arguments

With 4.3.3 and later. This fixes a bunch of them in drivers/base

Signed-off-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>
---

There's still more of these elsewhere in the tree and I may send
patches to fix them some day but for now, this takes care of the
driver core.

Index: linux-work/drivers/base/core.c
===================================================================
--- linux-work.orig/drivers/base/core.c	2009-06-17 11:40:09.000000000 +1000
+++ linux-work/drivers/base/core.c	2009-06-17 11:40:27.000000000 +1000
@@ -874,7 +874,7 @@ int device_add(struct device *dev)
 	 * the name, and force the use of dev_name()
 	 */
 	if (dev->init_name) {
-		dev_set_name(dev, dev->init_name);
+		dev_set_name(dev, "%s", dev->init_name);
 		dev->init_name = NULL;
 	}
 
@@ -1271,7 +1271,7 @@ struct device *__root_device_register(co
 	if (!root)
 		return ERR_PTR(err);
 
-	err = dev_set_name(&root->dev, name);
+	err = dev_set_name(&root->dev, "%s", name);
 	if (err) {
 		kfree(root);
 		return ERR_PTR(err);
Index: linux-work/drivers/base/sys.c
===================================================================
--- linux-work.orig/drivers/base/sys.c	2009-06-17 11:40:39.000000000 +1000
+++ linux-work/drivers/base/sys.c	2009-06-17 11:40:41.000000000 +1000
@@ -138,7 +138,7 @@ int sysdev_class_register(struct sysdev_
 	cls->kset.kobj.parent = &system_kset->kobj;
 	cls->kset.kobj.ktype = &ktype_sysdev_class;
 	cls->kset.kobj.kset = system_kset;
-	kobject_set_name(&cls->kset.kobj, cls->name);
+	kobject_set_name(&cls->kset.kobj, "%s", cls->name);
 	return kset_register(&cls->kset);
 }
 
Index: linux-work/drivers/base/attribute_container.c
===================================================================
--- linux-work.orig/drivers/base/attribute_container.c	2009-06-17 11:43:19.000000000 +1000
+++ linux-work/drivers/base/attribute_container.c	2009-06-17 11:43:22.000000000 +1000
@@ -167,7 +167,7 @@ attribute_container_add_device(struct de
 		ic->classdev.parent = get_device(dev);
 		ic->classdev.class = cont->class;
 		cont->class->dev_release = attribute_container_release;
-		dev_set_name(&ic->classdev, dev_name(dev));
+		dev_set_name(&ic->classdev, "%s", dev_name(dev));
 		if (fn)
 			fn(cont, dev, &ic->classdev);
 		else
Index: linux-work/drivers/base/firmware_class.c
===================================================================
--- linux-work.orig/drivers/base/firmware_class.c	2009-06-17 11:43:33.000000000 +1000
+++ linux-work/drivers/base/firmware_class.c	2009-06-17 11:43:38.000000000 +1000
@@ -392,7 +392,7 @@ static int fw_register_device(struct dev
 	fw_priv->timeout.data = (u_long) fw_priv;
 	init_timer(&fw_priv->timeout);
 
-	dev_set_name(f_dev, dev_name(device));
+	dev_set_name(f_dev, "%s", dev_name(device));
 	f_dev->parent = device;
 	f_dev->class = &firmware_class;
 	dev_set_drvdata(f_dev, fw_priv);
Index: linux-work/drivers/base/platform.c
===================================================================
--- linux-work.orig/drivers/base/platform.c	2009-06-17 11:43:00.000000000 +1000
+++ linux-work/drivers/base/platform.c	2009-06-17 11:43:02.000000000 +1000
@@ -244,7 +244,7 @@ int platform_device_add(struct platform_
 	if (pdev->id != -1)
 		dev_set_name(&pdev->dev, "%s.%d", pdev->name,  pdev->id);
 	else
-		dev_set_name(&pdev->dev, pdev->name);
+		dev_set_name(&pdev->dev, "%s", pdev->name);
 
 	for (i = 0; i < pdev->num_resources; i++) {
 		struct resource *p, *r = &pdev->resource[i];


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ