From: Julia Lawall <julia.lawall@lip6.fr>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
Alexander.Steffen@infineon.com, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
andriy.shevchenko@linux.intel.com, elfring@users.sourceforge.net,
linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
benh@kernel.crashing.org, clabbe.montjoie@gmail.com,
jarkko.sakkinen@linux.intel.com, jgunthorpe@obsidianresearch.com,
jsnitsel@redhat.com, kgold@linux.vnet.ibm.com,
mpe@ellerman.id.au, nayna@linux.vnet.ibm.com, paulus@samba.org,
PeterHuewe@gmx.de, Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: Re: [PATCH 3/4] char/tpm: Improve a size determination in nine functions
Date: Tue, 17 Oct 2017 17:29:20 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1710171725080.5035@hadrien> (raw)
In-Reply-To: <1508253453.4234.81.camel@linux.vnet.ibm.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; BOUNDARY="8323329-103149562-1508254160=:5035", Size: 9605 bytes --]
On Tue, 17 Oct 2017, Mimi Zohar wrote:
> On Tue, 2017-10-17 at 14:58 +0200, Julia Lawall wrote:
> >
> > On Tue, 17 Oct 2017, Mimi Zohar wrote:
> >
> > > On Tue, 2017-10-17 at 11:50 +0000, Alexander.Steffen@infineon.com
> > > wrote:
> > > > > > Replace the specification of data structures by pointer dereferences
> > > > > > as the parameter for the operator "sizeof" to make the corresponding
> > > > > > size
> > > > > > determination a bit safer according to the Linux coding style
> > > > > > convention.
> > > > >
> > > > >
> > > > > This patch does one style in favor of the other.
> > > >
> > > > I actually prefer that style, so I'd welcome this change :)
> > >
> > > Style changes should be reviewed and documented, like any other code
> > > change, and added to Documentation/process/coding-style.rst or an
> > > equivalent file.
> >
> > Actually, it has been there for many years:
> >
> > 14) Allocating memory
> > ---------------------
> > ...
> > The preferred form for passing a size of a struct is the following:
> >
> > .. code-block:: c
> >
> > p = kmalloc(sizeof(*p), ...);
> >
> > The alternative form where struct name is spelled out hurts readability and
> > introduces an opportunity for a bug when the pointer variable type is changed
> > but the corresponding sizeof that is passed to a memory allocator is not.
>
> True, thanks for the reminder. Is this common in new code? Is there
> a script/ or some other automated way of catching this usage before
> patches are upstreamed?
>
> Just as you're doing here, the patch description should reference this
> in the patch description.
The comment in the documentation seems have been there since Linux 2.6.14,
ie 2005. The fact that a lot of code still doesn't use that style, 12
years later, suggests that actually it is not preferred, or not preferred
by everyone. Perhaps the paragraph in coding style should just be
dropped.
julia
From James.Bottomley@HansenPartnership.com Wed Oct 18 14:53:40 2017
Return-Path: <linux-integrity-owner@vger.kernel.org>
X-Original-To: jarkko.sakkinen@linux.intel.com
Delivered-To: jarkko.sakkinen@linux.intel.com
Received: by jsakkine-mobl1 (fdm 1.7, account "linux.intel.com");
Wed, 18 Oct 2017 14:53:40 +0300
Received: from fmsmga006.fm.intel.com (fmsmga006.fm.intel.com [10.253.24.20])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by linux.intel.com (Postfix) with ESMTPS id 745DE5801AD;
Tue, 17 Oct 2017 08:57:18 -0700 (PDT)
Received: from orsmga102-1.jf.intel.com (HELO mga09.intel.com) ([10.7.208.27])
by fmsmga006-1.fm.intel.com with ESMTP; 17 Oct 2017 08:57:18 -0700
X-SG-BADATTACHMENTNOREPLY: True
IronPort-PHdr: =?us-ascii?q?9a23=3As+N+ox9gAwNX4v9uRHKM819IXTAuvvDOBiVQ1KB+?=
=?us-ascii?q?0+IRIJqq85mqBkHD//Il1AaPAd2DrasYwLuN+4nbGkU4qa6bt34DdJEeHzQksu?=
=?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1?=
=?us-ascii?q?Ov71GonPhMiryuy+4ZLebxlUi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AQ0BAREmAQUJAQEKGAICJgICA1QGAReKGAWpV2uCJ4MIAQEFiCs?=
=?us-ascii?q?BAQgBAQEBARsIgQ+CH4E2UYFRhRWIGIJhkl6OcpZmiWuHMpVwgTcCH4IRVSWDQ?=
=?us-ascii?q?oJNgjJWin4BAQE?=
X-IronPort-AV: E=Sophos;i="5.43,391,1503385200";
d="scan'208";a="486108914"
Received: from vger.kernel.org ([209.132.180.67])
by mtab.intel.com with ESMTP; 17 Oct 2017 08:57:17 -0700
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S934489AbdJQP5R (ORCPT <rfc822;mikko.ylinen@linux.intel.com>
+ 1 other); Tue, 17 Oct 2017 11:57:17 -0400
Received: from bedivere.hansenpartnership.com ([66.63.167.143]:52192 "EHLO
bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK)
by vger.kernel.org with ESMTP id S934488AbdJQP5Q (ORCPT
<rfc822;linux-integrity@vger.kernel.org>);
Tue, 17 Oct 2017 11:57:16 -0400
Received: from localhost (localhost [127.0.0.1])
by bedivere.hansenpartnership.com (Postfix) with ESMTP id 95D138EE1C3;
Tue, 17 Oct 2017 08:57:15 -0700 (PDT)
Received: from bedivere.hansenpartnership.com ([127.0.0.1])
by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id vmoAAn-eMTH0; Tue, 17 Oct 2017 08:57:15 -0700 (PDT)
Received: from [153.66.254.194] (unknown [50.35.65.221])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id BEBEF8EE0DF;
Tue, 17 Oct 2017 08:57:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com;
s=20151216; t=1508255835;
bh=F5axQ3kbLQ+wdnQKBx0FeqAZ4d6HeZHzV2qzIaRshKI=;
h=Subject:From:To:Cc:Date:In-Reply-To:References:From;
b=tZoqBd+b1MppXmtVyRwJr7Tu/i+he4up77m6Vug3xwn5Uz+hztZlMb/7c0Rxw8sno
COHZSSr6flfgwqNVlu14IQGER24x9/IzAWv2VP4BfxoVmHun+GizwW7fvXn9COUY3G
cHdYlxWsjErrvwkuni6mWeGAe4omdqhf2N82Trnk=
Message-ID: <1508255833.3129.33.camel@HansenPartnership.com>
Subject: Re: [PATCH 0/4] char-TPM: Adjustments for ten function
implementations
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
Dan Carpenter <dan.carpenter@oracle.com>,
linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Corentin Labbe <clabbe.montjoie@gmail.com>,
Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
Jerry Snitselaar <jsnitsel@redhat.com>,
Kenneth Goldman <kgold@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nayna Jain <nayna@linux.vnet.ibm.com>,
Paul Mackerras <paulus@samba.org>,
Peter =?ISO-8859-1?Q?H=FCwe?= <PeterHuewe@gmx.de>,
Stefan Berger <stefanb@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Date: Tue, 17 Oct 2017 08:57:13 -0700
In-Reply-To: <f9b35a67-bd7f-b140-bdc1-cb4886a6b1ea@users.sourceforge.net>
References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net>
<20171016183139.otyh3m5c5yurtmow@linux.intel.com>
<20171016183512.3bz6x4b6lbhpbkje@linux.intel.com>
<20171017085124.pkrjzghcf5wmcydc@mwanda>
<f9b35a67-bd7f-b140-bdc1-cb4886a6b1ea@users.sourceforge.net>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.20.5
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
Sender: linux-integrity-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-integrity.vger.kernel.org>
X-Mailing-List: linux-integrity@vger.kernel.org
On Tue, 2017-10-17 at 11:25 +0200, SF Markus Elfring wrote:
> >
> > Fixes is only for bug fixes. These don't fix any bugs.
>
> How do you distinguish these in questionable source code
> from other error categories or software weaknesses?
A style change is one that doesn't change the effect of the execution.
These don't actually even change the assembly, so there's programmatic
proof they're not fixing anything.
Bug means potentially user visible fault. In any bug fix commit you
should document the fault and its effects on users so those backporting
can decide if they care or not.
James
next prev parent reply other threads:[~2017-10-17 15:29 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 17:30 [PATCH 0/4] char-TPM: Adjustments for ten function implementations SF Markus Elfring
2017-10-16 17:31 ` [PATCH 1/4] char/tpm: Delete an error message for a failed memory allocation in tpm_ascii_bios_measurements_show() SF Markus Elfring
2017-10-16 17:32 ` [PATCH 2/4] char/tpm: Delete an error message for a failed memory allocation in tpm_ibmvtpm_probe() SF Markus Elfring
2017-10-16 17:33 ` [PATCH 3/4] char/tpm: Improve a size determination in nine functions SF Markus Elfring
2017-10-17 11:03 ` Andy Shevchenko
2017-10-17 11:50 ` Alexander.Steffen
2017-10-17 12:52 ` Mimi Zohar
2017-10-17 12:58 ` Julia Lawall
2017-10-17 15:17 ` Mimi Zohar
2017-10-17 15:29 ` Julia Lawall [this message]
2017-10-18 9:16 ` Alexander.Steffen
2017-10-17 18:41 ` SF Markus Elfring
2017-10-17 19:28 ` Mimi Zohar
2017-10-17 20:04 ` SF Markus Elfring
2017-10-17 19:36 ` Andy Shevchenko
2017-10-17 20:24 ` SF Markus Elfring
2017-10-18 14:57 ` Jarkko Sakkinen
2017-10-18 15:22 ` SF Markus Elfring
2017-10-18 15:59 ` Jarkko Sakkinen
2017-10-18 16:43 ` SF Markus Elfring
2017-10-18 17:18 ` Jarkko Sakkinen
2017-10-18 17:22 ` Jarkko Sakkinen
2017-10-18 17:54 ` SF Markus Elfring
2017-10-18 17:48 ` SF Markus Elfring
2017-10-18 17:54 ` Jerry Snitselaar
2017-10-18 18:11 ` char/tpm: Delete an error message for a failed memory allocation in tpm_…() SF Markus Elfring
2017-10-18 18:03 ` char/tpm: Improve a size determination in nine functions Andy Shevchenko
2017-10-19 12:04 ` Michal Suchánek
2017-10-19 12:16 ` Jarkko Sakkinen
2017-10-17 15:22 ` [PATCH 3/4] " Alexander.Steffen
[not found] ` <1508245325.16112.478.camel@linux.intel.com>
2017-10-18 14:52 ` Jarkko Sakkinen
2017-10-18 14:48 ` Jarkko Sakkinen
2017-10-19 16:58 ` Alexander.Steffen
2017-10-20 9:01 ` Jarkko Sakkinen
2017-10-20 10:23 ` Jarkko Sakkinen
2017-10-20 12:03 ` Alexander.Steffen
2017-10-23 13:20 ` Dan Carpenter
2017-10-18 14:40 ` Jarkko Sakkinen
2017-10-16 17:34 ` [PATCH 4/4] char/tpm: Less checks in tpm_ibmvtpm_probe() after error detection SF Markus Elfring
2017-10-19 11:56 ` Michal Suchánek
2017-10-19 12:36 ` SF Markus Elfring
2017-10-19 12:46 ` Michal Suchánek
2017-10-19 14:26 ` Dan Carpenter
2017-10-19 13:36 ` Dan Carpenter
2017-10-19 14:16 ` Michal Suchánek
2017-10-19 14:59 ` Dan Carpenter
2017-10-19 20:44 ` SF Markus Elfring
2017-10-16 18:31 ` [PATCH 0/4] char-TPM: Adjustments for ten function implementations Jarkko Sakkinen
2017-10-16 18:35 ` Jarkko Sakkinen
2017-10-16 20:44 ` SF Markus Elfring
2017-10-18 15:04 ` Jarkko Sakkinen
2017-10-18 15:43 ` SF Markus Elfring
2017-10-16 22:46 ` [PATCH 0/4] " Joe Perches
2017-10-17 7:20 ` SF Markus Elfring
2017-10-17 8:51 ` Dan Carpenter
2017-10-17 8:56 ` Julia Lawall
2017-10-17 9:44 ` Dan Carpenter
2017-10-17 10:11 ` Julia Lawall
2017-10-17 11:52 ` Mimi Zohar
2017-10-18 3:18 ` Michael Ellerman
2017-10-19 13:16 ` Mimi Zohar
2017-10-19 16:08 ` Circumstances for using the tag “Fixes” (or not) SF Markus Elfring
2017-10-17 12:26 ` [PATCH 0/4] char-TPM: Adjustments for ten function implementations Michael Ellerman
2017-10-18 15:07 ` Jarkko Sakkinen
2017-10-17 9:25 ` SF Markus Elfring
[not found] ` <1508255833.3129.33.camel@HansenPartnership.com>
2017-10-17 16:32 ` SF Markus Elfring
2017-10-17 22:43 ` Joe Perches
2017-10-18 9:00 ` SF Markus Elfring
2017-10-18 9:18 ` Joe Perches
2017-10-18 9:50 ` Alexander.Steffen
2017-10-18 10:00 ` Julia Lawall
2017-10-18 10:28 ` Joe Perches
2017-10-18 11:00 ` Adjusting further size determinations? SF Markus Elfring
2017-10-18 11:49 ` Joe Perches
2017-10-18 12:07 ` SF Markus Elfring
2017-10-18 12:58 ` David Laight
2017-10-18 13:32 ` Julia Lawall
2017-10-18 13:50 ` SF Markus Elfring
2017-10-18 10:44 ` char-TPM: Adjustments for ten function implementations Alexander.Steffen
2017-10-18 10:49 ` Joe Perches
2017-10-18 11:07 ` Alexander.Steffen
2017-10-18 9:55 ` SF Markus Elfring
2017-10-18 18:27 ` Michal Suchánek
2017-10-18 15:10 ` [PATCH 0/4] " Jarkko Sakkinen
2017-10-18 16:09 ` James Bottomley
2017-10-18 17:13 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1710171725080.5035@hadrien \
--to=julia.lawall@lip6.fr \
--cc=Alexander.Steffen@infineon.com \
--cc=PeterHuewe@gmx.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=benh@kernel.crashing.org \
--cc=clabbe.montjoie@gmail.com \
--cc=elfring@users.sourceforge.net \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=jsnitsel@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kgold@linux.vnet.ibm.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nayna@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox