[PATCH -mm] kernel/module.c: make_driver_name() can use kasrpintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

	make_driver_name() wants kasprintf(). Compile tested, also boots fine.

Signed-off-by: Mariusz Kozlowski <[email protected]>

 kernel/module.c | 68034 -> 67872 (-162 bytes)
 kernel/module.o | 128520 -> 128328 (-192 bytes)

 kernel/module.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

--- linux-2.6.24-rc3-mm1-a/kernel/module.c	2007-11-21 17:38:25.000000000 +0100
+++ linux-2.6.24-rc3-mm1-b/kernel/module.c	2007-11-26 20:14:53.000000000 +0100
@@ -2497,15 +2497,7 @@ void print_modules(void)
 #ifdef CONFIG_SYSFS
 static char *make_driver_name(struct device_driver *drv)
 {
-	char *driver_name;
-
-	driver_name = kmalloc(strlen(drv->name) + strlen(drv->bus->name) + 2,
-			      GFP_KERNEL);
-	if (!driver_name)
-		return NULL;
-
-	sprintf(driver_name, "%s:%s", drv->bus->name, drv->name);
-	return driver_name;
+	return kasprintf(GFP_KERNEL, "%s:%s", drv->bus->name, drv->name);
 }

 static void module_create_drivers_dir(struct module_kobject *mk)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux