From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932423AbcHNUMj (ORCPT ); Sun, 14 Aug 2016 16:12:39 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:36268 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752496AbcHNUMg (ORCPT ); Sun, 14 Aug 2016 16:12:36 -0400 Subject: Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_924074C7-95EE-4F3B-B2F2-A440ADC9830E"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Pgp-Agent: GPGMail From: Mark D Rustad In-Reply-To: <20160814123024.79c2082a@lwn.net> Date: Sun, 14 Aug 2016 13:12:33 -0700 Cc: Jean Delvare , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Elfring Message-Id: References: <20160725142906.003bfe06@endymion> <20160814123024.79c2082a@lwn.net> To: Jonathan Corbet X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_924074C7-95EE-4F3B-B2F2-A440ADC9830E Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; delsp=yes; format=flowed Jonathan Corbet wrote: > On Mon, 25 Jul 2016 14:29:06 +0200 > Jean Delvare 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 --Apple-Mail=_924074C7-95EE-4F3B-B2F2-A440ADC9830E Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJXsNCxAAoJEDwO/+eO4+5uIAoP/10cpL8iprUptvNhR2aWkN3k UMGZlbAfmNfM/e97l9uXtaBhfkVAoXjJ8wtaeTXJPTX4bpDfqA/adtS3H1tCyd21 ooqyrYyBCAQGU2vMrZGe6yHOgH+qlwD1+nVJz/84cwtcBx5WQyUoTolTO4FSQ7Ru SArlX/XzREBv8rhDWa4cqnremhY/DIxuIRi/U0P8QNg3yX7myAFMRnZrsCZho7K4 TvXtGmGoreMLdoSeXQwNRN01rAEuk8Jjj6whKhD7cpOHjiWlqcktkPEV6BaIaGF3 iNyqStGv/DuaY9eecsyej8VE8+3IWkjih70iiGgnlTNpoKB6X3bx/PjAz6D8v7w0 sWVcJuGFdHnVYcuAL+s9jLJzPMlAnj1uhemAqdNjfbtszEJY5YtG9YbVe4uo956f MwJKLVsc4wiSCIdHk27b7HwIknUnCB18pxQ4pFoHho3icZGgM6PVy6/FPkcDYw+t 6uF9kTkgFg3KdmxiEyko2BwKNfElf4HwZtU84VFvYumft0zzf/p3k7ThpOVaV0E7 IptlwJxYTasfJkJWs2P8QpIJWqHg/IAdKCqy2fDnhk1liIQfRT0uxVaqu8u1Zl79 mB7OFZL0v+cBkGjo1zX4cNE4vf5JQ09tIRYqQ+6XOPEVLHa9uBHFBz8JG2JJCBTt bBfPTym3DwONImYK0GPu =JzCd -----END PGP SIGNATURE----- --Apple-Mail=_924074C7-95EE-4F3B-B2F2-A440ADC9830E--