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)
-
| Mariusz Kozlowski | [PATCH 01] kmalloc + memset conversion co kzalloc |
| Rafael J. Wysocki | [Bug #10629] 2.6.26-rc1-$sha1: RIP __d_lookup+0x8c/0x160 |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Jeff Garzik | Re: [RFC] Heads up on sys_fallocate() |
git: | |
| Linus Torvalds | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
