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


Groups > linux.kernel > #1490713

Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val()

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val()
Date 2016-09-24 20:40 +0200
Message-ID <sl01H-4uy-9@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <skT0d-hj-3@gated-at.bofh.it> <skT0d-hj-1@gated-at.bofh.it> <skZp0-3Zr-1@gated-at.bofh.it> <skZIl-4oj-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Sep 24, 2016 at 08:16:16PM +0200, SF Markus Elfring wrote:
> > So we have to multiply twice now, once in kmalloc_array, the second
> > time in memcpy().
> 
> It looks so in the source code after the suggested refactoring.
> 
> 
> > No, thank you.
> 
> Would you like to check any further if a specific compiler implementation
> will still optimise common subexpressions as you desired it?
> 
> 
> > Also, please note that we do not really treat the allocated "mem" as an array,
> > but rather area of memory that holds all bits that we need to transfer,
> > and so I consider using kmalloc_array() actually wrong here.
> 
> Thanks for your explanation.
> 
> 
> > Please do not blindly follow checkpatch and coccinelle suggestions.
> > They are just that: suggestions and not hared rules.
> 
> I am curious on how to clarify corresponding deviations further.
> 
> 
> Would you like to suggest any other details so that the evolving scripts
> can become better and safer for static source code analysis?
> 
> Do you know any special properties which should be additionally checked
> at call sites which are similar to the discussed place?

If you are asking for some formal rules then no.

Again, what is the purpose of the changes? Are you working on the code
and the fact that the driver is older-style hinders your progress? Or
there are runtime improvements from your changes? Correctness issues?

I do not very much appreciate changes just to satisfy checkpatch rule
du jour.

Thanks.

-- 
Dmitry

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] Input-evdev: Use kmalloc_array() in  evdev_handle_get_val() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 13:10 +0200
  Re: [PATCH 1/2] Input-evdev: Use kmalloc_array() in evdev_handle_get_val() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-09-24 20:00 +0200
    Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 20:20 +0200
      Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-09-24 20:40 +0200
        Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 21:10 +0200

csiph-web