From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760044AbcIXSfA (ORCPT ); Sat, 24 Sep 2016 14:35:00 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36732 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756136AbcIXSe6 (ORCPT ); Sat, 24 Sep 2016 14:34:58 -0400 Date: Sat, 24 Sep 2016 11:34:55 -0700 From: Dmitry Torokhov To: SF Markus Elfring Cc: "linux-input@vger.kernel.org" , Henrik Rydberg , LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: Re: Input-evdev: Use kmalloc_array() in evdev_handle_get_val() Message-ID: <20160924183455.GD40187@dtor-ws> References: <566ABCD9.1060404@users.sourceforge.net> <92cc52f5-c5e1-cafe-76f2-04e4ed997735@users.sourceforge.net> <2a1f52e8-a502-1d4b-d9c9-e806cc6f246e@users.sourceforge.net> <56e70dc1-e36c-3492-d481-cef1e8262393@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56e70dc1-e36c-3492-d481-cef1e8262393@users.sourceforge.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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