* [PATCH] partitions: use kasprintf
@ 2007-11-17 10:57 Akinobu Mita
0 siblings, 0 replies; only message in thread
From: Akinobu Mita @ 2007-11-17 10:57 UTC (permalink / raw)
To: linux-kernel
Use kasprintf instead of kmalloc()-strcpy()-strcat().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-17 11:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-17 10:57 [PATCH] partitions: use kasprintf Akinobu Mita
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®