Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1462334

Re: [PATCH] CodingStyle: Clarify and complete chapter 7

From Mark D Rustad <mrustad@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] CodingStyle: Clarify and complete chapter 7
Date 2016-08-14 22:20 +0200
Message-ID <s6a2Z-4oa-13@gated-at.bofh.it> (permalink)
References <rYNbb-4vR-25@gated-at.bofh.it> <s68ue-3cX-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Jonathan Corbet <corbet@lwn.net> wrote:

> On Mon, 25 Jul 2016 14:29:06 +0200
> Jean Delvare <jdelvare@suse.de> wrote:
>
>> Chapter 7 (Centralized exiting of functions) of the coding style
>> documentation is unclear at times, and lacks some information (such
>> as the possibility to indent labels with a single space.) Clarify and
>> complete it.
>
> OK, I've applied this (finally) to the docs tree, sorry for sitting on it
> for so long.  One question, though...
>
>> A common type of bug to be aware of is "one err bugs" which look like  
>> this:
>>
>> -	err:
>> +	 err:
>>  		kfree(foo->bar);
>>  		kfree(foo);
>>  		return ret;
>>
>>  The bug in this code is that on some exit paths "foo" is NULL.  Normally the
>
> ...except that kfree() can handle null pointers just fine, so this isn't
> actually a bug, right?  Someday when somebody has time it would be good to
> come up with a better example.

But if foo is NULL, foo->bar is not NULL and so kfree will have a problem  
with it. So this is a bug.

--
Mark Rustad, MRustad@gmail.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Jonathan Corbet <corbet@lwn.net> - 2016-08-14 20:40 +0200
  Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Mark D Rustad <mrustad@gmail.com> - 2016-08-14 22:20 +0200
    Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Jonathan Corbet <corbet@lwn.net> - 2016-08-14 22:50 +0200
    Re: CodingStyle: Clarify and complete chapter 7 SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-15 17:40 +0200

csiph-web