From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935112AbcIXSQZ (ORCPT ); Sat, 24 Sep 2016 14:16:25 -0400 Received: from mout.web.de ([212.227.17.11]:50864 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933405AbcIXSQX (ORCPT ); Sat, 24 Sep 2016 14:16:23 -0400 Subject: Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val() To: Dmitry Torokhov References: <566ABCD9.1060404@users.sourceforge.net> <92cc52f5-c5e1-cafe-76f2-04e4ed997735@users.sourceforge.net> <2a1f52e8-a502-1d4b-d9c9-e806cc6f246e@users.sourceforge.net> Cc: "linux-input@vger.kernel.org" , Henrik Rydberg , LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <56e70dc1-e36c-3492-d481-cef1e8262393@users.sourceforge.net> Date: Sat, 24 Sep 2016 20:16:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:kZfmsooQDQdtFu7e+yz1gMYGSsYJtbGovyYqdpd9HYfiFmOGXXm Rln4nFFpDxCfhYz6vIk9Q/Hh+khABMtkE1J3WTIapdWV5D/mmQtiwIoRo6KupoH5PZz9/DW ztQxNRikturSLH6c+gahthmzJhvL1qMvl98ujQUQ2aHK8Hn5XiyrB55cYuC50reAHYOy0Sv hLSR92s87Le0c7TL5xCGQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:LPkxzHsq0zA=:A6ms2DCNu3LB5zgmUx+M7u MMFiOHVJz84h1M2tUcm10PV5xUgMkOJg8fc+BW6cTpkdceOahVwyfE74fAx+88LtQf/bag8L+ 5U2B5bvocRud+KclzTt9WmtGHz3l297YnMOF1AWmxn6aLn/NCXBpeyh5tN9GZ27wwJHS+Le8F q9rP1tgj5H6AjeV0+Xy7dXATUwCpS/7NwV7vnM950LtFjvWHWCjfzVrEHjzpgXz5bgy1o70Ur 5ZlLIsuLyAr0kVYes8fEGQIXISRxvtAP36PMoMPL3jJVgeGOn2TNiEI8xUsUoPeP9OTY2h4ga PuaI3nde7N7a2gRGKDWt4qnguq0om7ZX+bWG0VzAX21UsaFKEeQ/u2gyxj6TszakEiLXHehMh PAIhSeRg3v68FOBplnm8js/ibIlBJ/PP/9pw8MQ1e4bcDWIUGVqHnXhnW/MoKcE1rT8azZo6F b2kY0dLA81gVcNzHGhrKkXD5r6HfcfUL+gq8ZpNbhBRxPtjjX6mPF5iDgck6NIP8fZIVRLpne 6VOOBj9cASVDkti8xWutOgX3HnB1LVhQP6ngTmx0m6oWfnfCAHkG9kdfIleR2wDXIJ5l5Azv2 o8hjT9uOxW9ptbozYVfNH2HW78zifywu9t4buJkAr8Bgev88t9aB0UzmcaL5tm/SwLjmf7wcd Z1TQbOIdKH5bLTZ9cl2gZbLiMgyiIVgr4XxejMzcDQ0LmAP2LSaWGQo4ck5MIDhcR8BtnuLYc F0wGWjQex3j4Ua9jMgvSQ5yWNHy1JNUPB6T6SaTDIfKoDFc5PdGYkbblI1vCPIBnXJfra31fU rzU3YQT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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? Regards, Markus