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>] [day] [month] [year] [list]
Message-ID: <20071117105738.GB4861@APFDCB5C>
Date:	Sat, 17 Nov 2007 19:57:38 +0900
From:	Akinobu Mita <akinobu.mita@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] partitions: use kasprintf

Use kasprintf instead of kmalloc()-strcpy()-strcat().

Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>

---
 fs/partitions/check.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Index: 2.6-mm/fs/partitions/check.c
===================================================================
--- 2.6-mm.orig/fs/partitions/check.c
+++ 2.6-mm/fs/partitions/check.c
@@ -453,16 +453,11 @@ void add_partition(struct gendisk *disk,
 static char *make_block_name(struct gendisk *disk)
 {
 	char *name;
-	static char *block_str = "block:";
-	int size;
 	char *s;
 
-	size = strlen(block_str) + strlen(disk->disk_name) + 1;
-	name = kmalloc(size, GFP_KERNEL);
+	name = kasprintf(GFP_KERNEL, "block:%s", disk->disk_name);
 	if (!name)
 		return NULL;
-	strcpy(name, block_str);
-	strcat(name, disk->disk_name);
 	/* ewww... some of these buggers have / in name... */
 	s = strchr(name, '/');
 	if (s)
-
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