From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: discussion [patch] /lib/kobject.c
Date: Thu, 11 Mar 2010 08:13:02 +0000 [thread overview]
Message-ID: <4B98A60E.8050705@bfs.de> (raw)
In-Reply-To: <4B975F28.4050903@bfs.de>
Julia Lawall schrieb:
> I guess something similar could be done with snprintf?
>
> The following code comes from /var/linuxes/linux-next/arch/ia64/pci/pci.c
>
> len = strlen(info->name) + 32;
> name = kzalloc(len, GFP_KERNEL);
> if (!name) {
> printk(KERN_ERR "PCI: No memory for %s I/O port space name\n",
> info->name);
> goto free_resource;
> }
>
> min = addr->minimum;
> max = min + addr->address_length - 1;
> if (addr->info.io.translation_type = ACPI_SPARSE_TRANSLATION)
> sparse = 1;
>
> space_nr = new_space(addr->translation_offset, sparse);
> if (space_nr = ~0)
> goto free_name;
>
> base = __pa(io_space[space_nr].mmio_base);
> base_port = IO_SPACE_BASE(space_nr);
> snprintf(name, len, "%s I/O Ports %08lx-%08lx", info->name,
> base_port + min, base_port + max);
>
yes, i would replace that with:
name = kasprintf(GFP_KERNEL,"%s I/O Ports %08lx-%08lx", info->name,
base_port + min, base_port + max);
if (!name) {
printk(KERN_ERR "PCI: No memory for %s I/O port space name\n",
info->name);
goto free_resource;
}
re,
wh
prev parent reply other threads:[~2010-03-11 8:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-10 8:58 discussion [patch] /lib/kobject.c walter harms
2010-03-10 9:51 ` Julia Lawall
2010-03-10 20:27 ` Julia Lawall
2010-03-11 8:13 ` walter harms [this message]
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=4B98A60E.8050705@bfs.de \
--to=wharms@bfs.de \
--cc=kernel-janitors@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