From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Joe Perches <joe@perches.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
linux-ia64@vger.kernel.org, Fenghua Yu <fenghua.yu@intel.com>,
Tony Luck <tony.luck@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 1/5] IA64-IRQ: Use kmalloc_array() in sn_irq_lh_init()
Date: Sat, 27 Aug 2016 09:02:49 +0200 [thread overview]
Message-ID: <894bf885-4cf0-fcaa-e040-35d9add64acc@users.sourceforge.net> (raw)
In-Reply-To: <1472245341.4914.79.camel@perches.com>
>>> @@ -474,12 +474,12 @@ void __init sn_irq_lh_init(void)
>>> {
>>> int i;
>>>
>>> - sn_irq_lh = kmalloc(sizeof(struct list_head *) * NR_IRQS, GFP_KERNEL);
>>> + sn_irq_lh = kmalloc_array(NR_IRQS, sizeof(*sn_irq_lh), GFP_KERNEL);
>>> if (!sn_irq_lh)
>>> panic("SN PCI INIT: Failed to allocate memory for PCI init\n");
>>>
>>> for (i = 0; i < NR_IRQS; i++) {
>>> - sn_irq_lh[i] = kmalloc(sizeof(struct list_head), GFP_KERNEL);
>>> + sn_irq_lh[i] = kmalloc(*sn_irq_lh[i], GFP_KERNEL);
>>
>> Did a sizeof get lost here?
>
> Yes, thanks Julia.
Unfortunately, another copy mistake happened during a bit of
source code editing.
> This is why adding the generating spatch code is always good.
I find that this broken update suggestion can point a few details out
for further considerations.
I dared to combine some software aspects once more in this use case.
Such a combination (join point) shows interesting challenges,
doesn't it?
> And Markus, please always compile test your code using the
> appropriate cross-compilers available here:
> https://www.kernel.org/pub/tools/crosstool/
Thanks for your link.
> And btw: using sizeof(*pp[i]) or sizeof(**pp) is not always
> clearer or better than using sizeof(type)
Do you express a target conflict between your expectations
and the evolving Linux coding style documentation here?
Would any software developers insist to see the corresponding
data type directly instead of "evaluating" a pointer expression?
> If you _really wanted to clear up this code and make it more
> robust/better, it'd probably be nicer to convert the
> struct list_head **sn_irq_lh to a single struct list_head *
…
> That would be less data space overall given the alignment
> waste of the individual allocs.
Does this suggestion mean that I should drop my proposal
around the software components "IRQ" and "TLB" for the system
architecture "IA64" in such a questionable patch series?
Regards,
Markus
next prev parent reply other threads:[~2016-08-27 7:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 18:00 [PATCH 0/5] IA64: Fine-tuning for some function implementations SF Markus Elfring
2016-08-26 18:02 ` [PATCH 1/5] IA64-IRQ: Use kmalloc_array() in sn_irq_lh_init() SF Markus Elfring
2016-08-26 19:57 ` Julia Lawall
2016-08-26 21:02 ` Joe Perches
2016-08-27 7:02 ` SF Markus Elfring [this message]
2016-08-28 0:40 ` Joe Perches
2016-08-28 7:37 ` SF Markus Elfring
2016-08-28 9:28 ` [PATCH 1/5] " Julia Lawall
2016-08-28 18:33 ` Joe Perches
2016-08-27 6:20 ` SF Markus Elfring
2016-08-26 20:18 ` [PATCH 1/5] " kbuild test robot
2016-08-27 8:48 ` walter harms
2016-08-26 18:03 ` [PATCH 2/5] IA64-IRQ: Delete unnecessary braces SF Markus Elfring
2016-08-26 20:27 ` kbuild test robot
2016-08-26 18:04 ` [PATCH 3/5] ia64/mm/tlb: Fix indentation in ia64_global_tlb_purge() SF Markus Elfring
2016-08-26 18:05 ` [PATCH 4/5] ia64/mm/tlb: Use kmalloc_array() in ia64_itr_entry() SF Markus Elfring
2016-08-26 18:06 ` [PATCH 5/5] ia64/mm/tlb: Delete unnecessary braces SF Markus Elfring
2016-08-26 20:42 ` kbuild test robot
2016-08-27 7:29 ` SF Markus Elfring
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=894bf885-4cf0-fcaa-e040-35d9add64acc@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=fenghua.yu@intel.com \
--cc=joe@perches.com \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=tony.luck@intel.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