From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751410AbdJRS1x (ORCPT ); Wed, 18 Oct 2017 14:27:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:45987 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751110AbdJRS1v (ORCPT ); Wed, 18 Oct 2017 14:27:51 -0400 Date: Wed, 18 Oct 2017 20:27:45 +0200 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= To: Joe Perches Cc: SF Markus Elfring , linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org, Stefan Berger , Nayna Jain , Jerry Snitselaar , LKML , Jarkko Sakkinen , Jason Gunthorpe , Corentin Labbe , James Bottomley , Paul Mackerras , Peter =?UTF-8?B?SMO8d2U=?= , Andy Shevchenko , Dan Carpenter , Kenneth Goldman Subject: Re: char-TPM: Adjustments for ten function implementations Message-ID: <20171018202745.383724bc@kitsune.suse.cz> In-Reply-To: <1508318326.6806.1.camel@perches.com> References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <20171016183139.otyh3m5c5yurtmow@linux.intel.com> <20171016183512.3bz6x4b6lbhpbkje@linux.intel.com> <20171017085124.pkrjzghcf5wmcydc@mwanda> <1508255833.3129.33.camel@HansenPartnership.com> <1508280210.6530.32.camel@perches.com> <1508318326.6806.1.camel@perches.com> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Oct 2017 02:18:46 -0700 Joe Perches wrote: > On Wed, 2017-10-18 at 11:00 +0200, SF Markus Elfring wrote: > > > The printk removals do change the objects. > > > > > > The value of that type of change is only for resource limited > > > systems. > > > > I imagine that such small code adjustments are also useful for > > other systems. > > Your imagination and mine differ. > Where do you _think_ it matters? > > For instance, nothing about > > sizeof(type) > vs > sizeof(*ptr) > > makes it easier for a human to read the code. > However, it makes it less error-prone to modify the code. If you do ptr = malloc(sizeof(*ptr)) and later you change the type of the pointer the code is still correct whereas ptr = malloc(sizeof(some type) no longer is. That is the reason the source analysis tool warns about this usage and you do not really need any more explanation for *this* change. The others are not so clear. Thanks Michal From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= Date: Wed, 18 Oct 2017 18:27:45 +0000 Subject: Re: char-TPM: Adjustments for ten function implementations Message-Id: <20171018202745.383724bc@kitsune.suse.cz> List-Id: References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <20171016183139.otyh3m5c5yurtmow@linux.intel.com> <20171016183512.3bz6x4b6lbhpbkje@linux.intel.com> <20171017085124.pkrjzghcf5wmcydc@mwanda> <1508255833.3129.33.camel@HansenPartnership.com> <1508280210.6530.32.camel@perches.com> <1508318326.6806.1.camel@perches.com> In-Reply-To: <1508318326.6806.1.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Joe Perches Cc: SF Markus Elfring , linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org, Stefan Berger , Nayna Jain , Jerry Snitselaar , LKML , Jarkko Sakkinen , Jason Gunthorpe , Corentin Labbe , James Bottomley , Paul Mackerras , Peter =?UTF-8?B?SMO8d2U=?= , Andy Shevchenko , Dan Carpenter , Kenneth Goldman On Wed, 18 Oct 2017 02:18:46 -0700 Joe Perches wrote: > On Wed, 2017-10-18 at 11:00 +0200, SF Markus Elfring wrote: > > > The printk removals do change the objects. > > > > > > The value of that type of change is only for resource limited > > > systems. > > > > I imagine that such small code adjustments are also useful for > > other systems. > > Your imagination and mine differ. > Where do you _think_ it matters? > > For instance, nothing about > > sizeof(type) > vs > sizeof(*ptr) > > makes it easier for a human to read the code. > However, it makes it less error-prone to modify the code. If you do ptr = malloc(sizeof(*ptr)) and later you change the type of the pointer the code is still correct whereas ptr = malloc(sizeof(some type) no longer is. That is the reason the source analysis tool warns about this usage and you do not really need any more explanation for *this* change. The others are not so clear. Thanks Michal