Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1483471 > unrolled thread

Re: perf/x86: Use kmalloc_array() in merge_attr()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-09-14 18:50 +0200
Last post2016-09-14 19:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: perf/x86: Use kmalloc_array() in merge_attr() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 18:50 +0200
    Re: perf/x86: Use kmalloc_array() in merge_attr() Peter Zijlstra <peterz@infradead.org> - 2016-09-14 19:10 +0200
      Re: perf/x86: Use kmalloc_array() in merge_attr() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 19:50 +0200

#1483471 — Re: perf/x86: Use kmalloc_array() in merge_attr()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-14 18:50 +0200
SubjectRe: perf/x86: Use kmalloc_array() in merge_attr()
Message-ID<shlxL-3gE-5@gated-at.bofh.it>
>> * A multiplication for the size determination of a memory allocation
>>   indicated that an array data structure should be processed.
>>   Thus use the corresponding function "kmalloc_array".
>>
>>   This issue was detected by using the Coccinelle software.
>>
>> * Replace the specification of a data structure by a pointer dereference
>>   to make the corresponding size determination a bit safer according to
>>   the Linux coding style convention.
> 
> Why!?

How do you think about an information like the following from
the well-known script "checkpatch.pl"?

WARNING: Prefer kmalloc_array over kmalloc with multiply


Would you like to suggest any more constraints for this kind of
software refactoring?

Regards,
Markus

[toc] | [next] | [standalone]


#1483488

FromPeter Zijlstra <peterz@infradead.org>
Date2016-09-14 19:10 +0200
Message-ID<shlR7-3Ce-15@gated-at.bofh.it>
In reply to#1483471
On Wed, Sep 14, 2016 at 06:40:32PM +0200, SF Markus Elfring wrote:
> 
> Would you like to suggest any more constraints for this kind of
> software refactoring?

Yes, don't do it. If you're writing new code by all means, do whatever
you feel, but don't go changing code just because checkpatch.

[toc] | [prev] | [next] | [standalone]


#1483507

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-14 19:50 +0200
Message-ID<shmtP-3OB-1@gated-at.bofh.it>
In reply to#1483488
>> Would you like to suggest any more constraints for this kind of
>> software refactoring?
> 
> Yes, don't do it.

I am bit surprised by this feedback.


> If you're writing new code by all means, do whatever you feel,

Could you accept related software updates then?


> but don't go changing code just because checkpatch.

Why is this not a valid reason for you?

How useful can properties that are provided by a function like
kmalloc_array() be also for software modules which you care about?


Do you find any other software improvements more worthwhile?

Regards,
Markus

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web