[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <49FA5AD5.3070804@kernel.org>
Date: Thu, 30 Apr 2009 19:13:41 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Matthew Wilcox <matthew@....cx>
CC: James Bottomley <James.Bottomley@...senPartnership.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kay Sievers <kay.sievers@...y.org>, Greg KH <gregkh@...e.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linux-Scsi <linux-scsi@...r.kernel.org>
Subject: [PATCH] scsi: ses check name in enclosure_component_register -v2
dev_set_name will use sprintf to copy the name.
need to check if the name does valid.
otherwise will error from device_add later.
v2: add %s in dev_set_name according to James
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
drivers/misc/enclosure.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: linux-2.6/drivers/misc/enclosure.c
===================================================================
--- linux-2.6.orig/drivers/misc/enclosure.c
+++ linux-2.6/drivers/misc/enclosure.c
@@ -119,7 +119,7 @@ enclosure_register(struct device *dev, c
edev->edev.class = &enclosure_class;
edev->edev.parent = get_device(dev);
edev->cb = cb;
- dev_set_name(&edev->edev, name);
+ dev_set_name(&edev->edev, "%s", name);
err = device_register(&edev->edev);
if (err)
goto err;
@@ -255,8 +255,8 @@ enclosure_component_register(struct encl
ecomp->number = number;
cdev = &ecomp->cdev;
cdev->parent = get_device(&edev->edev);
- if (name)
- dev_set_name(cdev, name);
+ if (name && name[0])
+ dev_set_name(cdev, "%s", name);
else
dev_set_name(cdev, "%u", number);
--
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