From: Yan Burman <burman.yan@gmail.com>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-kernel@vger.kernel.org, trivial@kernel.org,
wli@holomorphy.com, sparclinux@vger.kernel.org
Subject: Re: [PATCH 2.6.19-rc6] sparc: replace kmalloc+memset with kzalloc
Date: Fri, 24 Nov 2006 21:02:53 +0200 [thread overview]
Message-ID: <456741DD.6060103@gmail.com> (raw)
In-Reply-To: <45672D00.8060903@s5r6.in-berlin.de>
Stefan Richter wrote:
> Yan Burman wrote:
> ...
>
>> --- linux-2.6.19-rc5_orig/arch/sparc/kernel/sun4d_irq.c 2006-11-09 12:16:21.000000000 +0200
>> +++ linux-2.6.19-rc5_kzalloc/arch/sparc/kernel/sun4d_irq.c 2006-11-11 22:44:04.000000000 +0200
>> @@ -545,8 +545,7 @@ void __init sun4d_init_sbi_irq(void)
>> nsbi = 0;
>> for_each_sbus(sbus)
>> nsbi++;
>> - sbus_actions = (struct sbus_action *)kmalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
>> - memset (sbus_actions, 0, (nsbi * 8 * 4 * sizeof(struct sbus_action)));
>> + sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
>> for_each_sbus(sbus) {
>> #ifdef CONFIG_SMP
>> extern unsigned char boot_cpu_id;
>>
>
> I'm not sure about this ^ hunk, but...
>
>
>> diff -rubp linux-2.6.19-rc5_orig/arch/sparc/mm/io-unit.c linux-2.6.19-rc5_kzalloc/arch/sparc/mm/io-unit.c
>> --- linux-2.6.19-rc5_orig/arch/sparc/mm/io-unit.c 2006-11-09 12:16:21.000000000 +0200
>> +++ linux-2.6.19-rc5_kzalloc/arch/sparc/mm/io-unit.c 2006-11-11 22:44:04.000000000 +0200
>> @@ -41,9 +41,8 @@ iounit_init(int sbi_node, int io_node, s
>> struct linux_prom_registers iommu_promregs[PROMREG_MAX];
>> struct resource r;
>>
>> - iounit = kmalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
>> + iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
>>
>> - memset(iounit, 0, sizeof(*iounit));
>> iounit->limit[0] = IOUNIT_BMAP1_START;
>> iounit->limit[1] = IOUNIT_BMAP2_START;
>> iounit->limit[2] = IOUNIT_BMAPM_START;
>>
>
> ...in this ^, the old code and your update don't check for NULL return.
>
Both of this parts are done at early stages, so it is probably:
a) Impossible to recover from failure
b) If you run out of memory at this stage, you are probably in very big
trouble anyway
I could modify it to check and panic if the check fails.
Would that be better?
next prev parent reply other threads:[~2006-11-24 19:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-24 12:01 [PATCH 2.6.19-rc6] sparc: replace kmalloc+memset with kzalloc Yan Burman
2006-11-24 17:33 ` Stefan Richter
2006-11-24 19:02 ` Yan Burman [this message]
2006-11-24 19:13 ` Stefan Richter
2006-11-24 21:52 ` David Miller
2006-12-01 1:12 ` David Miller
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=456741DD.6060103@gmail.com \
--to=burman.yan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=stefanr@s5r6.in-berlin.de \
--cc=trivial@kernel.org \
--cc=wli@holomorphy.com \
/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