linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "L. A. Walsh" <lkml@tlinx.org>
To: linux-kernel@vger.kernel.org
Cc: Adrian Bunk <bunk@stusta.de>, Jean Delvare <khali@linux-fr.org>
Subject: Re: Do not misuse Coverity please (Was: sound/oss/cs46xx.c: fix a check after use)
Date: Mon, 28 Mar 2005 15:57:11 -0800	[thread overview]
Message-ID: <424899D7.1080407@tlinx.org> (raw)
In-Reply-To: <20050327214323.GH4285@stusta.de>



Adrian Bunk wrote:

>On Sun, Mar 27, 2005 at 11:21:58PM +0200, Jean Delvare wrote:
>  
>
>
>There are two cases:
>1. NULL is impossible, the check is superfluous
>2. this was an actual bug
>
>In the first case, my patch doesn't do any harm (a superfluous isn't a 
>real bug).
>
>In the second case, it fixed a bug.
>It might be a bug not many people hit because it might be in some error 
>path of some esoteric driver.
>
>If a maintainer of a well-maintained subsystem like i2c says
>"The check is superfluous." that's the perfect solution.
>
>But in less maintained parts of the kernel, even a low possibility that 
>it fixes a possible bug is IMHO worth making such a riskless patch.
>  
>
---
    I'd agree in [al]most any part of the kernel.  Unless it
is extremely time critical code, subroutines should expect
possible garbage from their callers.

    Just because it may be perfect today doesn't mean someone down
the line won't call the routine with less than perfect parameters.

    It used to be called "defensive" programming.

    However, in this case, if the author is _certain_ the
pointer can never be NULL, than an "ASSERT(card!=NULL);" might
be appropriate, where ASSERT is a macro that normally compiles
in the check, but could compile to "nothing" for embedded or
kernels that aren't being developed in.

-linda

>  
>
>>Thanks,
>>Jean Delvare
>>    
>>
>
>cu
>Adrian
>
>  
>

  parent reply	other threads:[~2005-03-28 23:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-27 20:50 [2.6 patch] sound/oss/cs46xx.c: fix a check after use Adrian Bunk
2005-03-27 21:21 ` Do not misuse Coverity please (Was: sound/oss/cs46xx.c: fix a check after use) Jean Delvare
2005-03-27 21:43   ` Adrian Bunk
2005-03-27 22:34     ` Jean Delvare
2005-03-27 22:45       ` Russell King
2005-03-28 12:54       ` Matthias-Christian Ott
2005-03-28 23:57     ` L. A. Walsh [this message]
2005-03-29  6:05       ` Daniel Barkalow
2005-03-29  6:23   ` Andrew Morton
2005-03-29 10:46     ` Jean Delvare
2005-03-29 14:12       ` Chris Friesen
2005-03-30  1:25       ` Horst von Brand
2005-03-30  7:53         ` Do not misuse Coverity please Jean Delvare
2005-03-30 17:09           ` Horst von Brand
2005-04-11 20:23             ` Pavel Machek
2005-03-30 18:29           ` Shankar Unni
2005-03-30 18:55             ` Olivier Galibert
2005-03-31  2:01               ` Patrick McFarland
2005-03-30 19:14             ` Paulo Marques
2005-03-30 23:11               ` Big GCC bug!!! [Was: Re: Do not misuse Coverity please] Kyle Moffett
2005-03-30 23:38                 ` Not a GCC bug (was Re: Big GCC bug!!! [Was: Re: Do not misuse Coverity please]) Jakub Jelinek
2005-03-31  0:58                   ` Kyle Moffett
2005-03-31  1:12                     ` Nick Piggin
2005-03-31  1:27                       ` Kyle Moffett
2005-03-29 14:22     ` Do not misuse Coverity please (Was: sound/oss/cs46xx.c: fix a check after use) Daniel Jacobowitz
2005-03-29 22:37       ` Kyle Moffett

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=424899D7.1080407@tlinx.org \
    --to=lkml@tlinx.org \
    --cc=bunk@stusta.de \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).