* Re: [PATCH] New Chapter on CodingStyle . [not found] <1502536998-5482-1-git-send-email-asd@marian1000.go.ro> @ 2017-08-12 14:54 ` Jonathan Corbet 2017-08-15 10:42 ` David Laight 0 siblings, 1 reply; 4+ messages in thread From: Jonathan Corbet @ 2017-08-12 14:54 UTC (permalink / raw) To: Corcodel Marian Cc: netdev, linux-doc, linux-kernel, Realtek linux nic maintainers On Sat, 12 Aug 2017 14:23:18 +0300 Corcodel Marian <asd@marian1000.go.ro> wrote: > --- > Documentation/CodingStyle | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle > index 9a70ddd..864dd8b 100644 > --- a/Documentation/CodingStyle > +++ b/Documentation/CodingStyle > @@ -922,6 +922,34 @@ expression used. For instance: > ... > #endif /* CONFIG_SOMETHING */ > > + Chapter 20: Put values on initialisers without exception > + > +When declaring variables on functions must put values: Thanks for sending a patch for the kernel's documentation. Unfortunately, I can't accept this patch for a couple of reasons: - Kernel patches must include a changelog describing *why* the change is being made and a proper signoff line. See Documentation/process/submitting-patches.rst for details. - The coding style document is there to describe the community's standards for kernel code. It is *not* a mechanism for imposing new standards. If you really think that the kernel community should adopt this rule, you will need to argue for it on the mailing lists. I will say, though, that I do not expect that this effort would be successful. Can I make a suggestion? If you have found kernel functions with bugs related to use of uninitialized variables, please submit fixes for those specific bugs, along with a clear description of how the bug happens and what its effects are. Thanks, jon ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] New Chapter on CodingStyle . 2017-08-12 14:54 ` [PATCH] New Chapter on CodingStyle Jonathan Corbet @ 2017-08-15 10:42 ` David Laight 2017-08-15 16:20 ` Stephen Hemminger 0 siblings, 1 reply; 4+ messages in thread From: David Laight @ 2017-08-15 10:42 UTC (permalink / raw) To: 'Jonathan Corbet', Corcodel Marian Cc: netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Realtek linux nic maintainers From: Jonathan Corbet > Sent: 12 August 2017 15:55 ... > > + Chapter 20: Put values on initialisers without exception > > + > > +When declaring variables on functions must put values: > > Thanks for sending a patch for the kernel's documentation. > Unfortunately, I can't accept this patch for a couple of reasons: ... > - The coding style document is there to describe the community's > standards for kernel code. It is *not* a mechanism for imposing new > standards. If you really think that the kernel community should adopt > this rule, you will need to argue for it on the mailing lists. I will > say, though, that I do not expect that this effort would be successful. I'd even go as far as suggesting almost the opposite. Declarations should only have initialisers if the value is constant. David ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] New Chapter on CodingStyle . 2017-08-15 10:42 ` David Laight @ 2017-08-15 16:20 ` Stephen Hemminger 2017-08-15 16:55 ` David Laight 0 siblings, 1 reply; 4+ messages in thread From: Stephen Hemminger @ 2017-08-15 16:20 UTC (permalink / raw) To: David Laight Cc: 'Jonathan Corbet', Corcodel Marian, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Realtek linux nic maintainers On Tue, 15 Aug 2017 10:42:39 +0000 David Laight <David.Laight@ACULAB.COM> wrote: > From: Jonathan Corbet > > Sent: 12 August 2017 15:55 > ... > > > + Chapter 20: Put values on initialisers without exception > > > + > > > +When declaring variables on functions must put values: > > > > Thanks for sending a patch for the kernel's documentation. > > Unfortunately, I can't accept this patch for a couple of reasons: > ... > > - The coding style document is there to describe the community's > > standards for kernel code. It is *not* a mechanism for imposing new > > standards. If you really think that the kernel community should adopt > > this rule, you will need to argue for it on the mailing lists. I will > > say, though, that I do not expect that this effort would be successful. > > I'd even go as far as suggesting almost the opposite. > Declarations should only have initialisers if the value is constant. Yup. This new rule sound like something taught to people in coding schools. But initializing everything defeats the compiler detection of uninitialized variables which is more useful for catching errors. ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] New Chapter on CodingStyle . 2017-08-15 16:20 ` Stephen Hemminger @ 2017-08-15 16:55 ` David Laight 0 siblings, 0 replies; 4+ messages in thread From: David Laight @ 2017-08-15 16:55 UTC (permalink / raw) To: 'Stephen Hemminger' Cc: 'Jonathan Corbet', Corcodel Marian, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Realtek linux nic maintainers From: Stephen Hemminger > Sent: 15 August 2017 17:21 > On Tue, 15 Aug 2017 10:42:39 +0000 > David Laight <David.Laight@ACULAB.COM> wrote: > > > From: Jonathan Corbet > > > Sent: 12 August 2017 15:55 > > ... > > > > + Chapter 20: Put values on initialisers without exception > > > > + > > > > +When declaring variables on functions must put values: > > > > > > Thanks for sending a patch for the kernel's documentation. > > > Unfortunately, I can't accept this patch for a couple of reasons: > > ... > > > - The coding style document is there to describe the community's > > > standards for kernel code. It is *not* a mechanism for imposing new > > > standards. If you really think that the kernel community should adopt > > > this rule, you will need to argue for it on the mailing lists. I will > > > say, though, that I do not expect that this effort would be successful. > > > > I'd even go as far as suggesting almost the opposite. > > Declarations should only have initialisers if the value is constant. > > Yup. This new rule sound like something taught to people in coding schools. > But initializing everything defeats the compiler detection of uninitialized variables > which is more useful for catching errors. You'll also get: Values being read the wrong side of locks. Values being read early so requiring spilling to stack. Next someone will be suggesting that all pointers should be checked against NULL every time they are used. David ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-15 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1502536998-5482-1-git-send-email-asd@marian1000.go.ro>
2017-08-12 14:54 ` [PATCH] New Chapter on CodingStyle Jonathan Corbet
2017-08-15 10:42 ` David Laight
2017-08-15 16:20 ` Stephen Hemminger
2017-08-15 16:55 ` David Laight
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).