From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] partitions: use kasprintf
Date: Sat, 17 Nov 2007 19:57:38 +0900 [thread overview]
Message-ID: <20071117105738.GB4861@APFDCB5C> (raw)
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)
reply other threads:[~2007-11-17 11:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071117105738.GB4861@APFDCB5C \
--to=akinobu.mita@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®