mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Jeff Garzik <jeff@garzik.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	ak@suse.de, adaplas@gmail.com,
	linux-fbdev-devel@lists.sourceforge.net,
	benh@kernel.crashing.org
Subject: Re: [git patches] two warning fixes
Date: Thu, 19 Jul 2007 11:00:30 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.999.0707191056010.27353@woody.linux-foundation.org> (raw)
In-Reply-To: <m3vecgbjix.fsf@maximus.localdomain>



On Thu, 19 Jul 2007, Krzysztof Halasa wrote:
> >
> >   We absolutely NEVER add things like "must_check" unless not checking 
> >   causes a real and obvious SECURITY ISSUE.
> 
> Oh, come on, almost every kernel bug is a potential security issue.

Sure. And adding unnecessary checking that doesn't make sense makes bugs 
*more* likely rather than less.

> IMHO, if the function can only fail due to a kernel bug, it should
> return void and, in case of bug, explode with BUG_ON() or something
> like that. Sure, must_check doesn't apply too well to void.

There are absolutely tons of functions that can return errors (or other 
values), and where many users MAY SIMPLY NOT CARE.

I think "must_check" is an abomination. It makes the callee dictate what 
the caller has to do, but dammit, if the callee really "knows" its errors 
are that serious, it should damn well handle them itself.

The whole "sysfs_create_file()" thing is an example of that. If it fails, 
it fails. The caller can't do anythign about it anyway, except perhaps 
print a message.  Why the hell does such a function have the "right" to 
dictate what the user should do?

That doesn't mean that *all* callers migth not care. Maybe some internal 
sysfs routines really should care. But not a random driver.

			Linus

  reply	other threads:[~2007-07-19 18:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 23:55 Jeff Garzik
2007-07-18 23:59 ` Andi Kleen
2007-07-19  0:05   ` Jeff Garzik
2007-07-19  1:19     ` Benjamin Herrenschmidt
2007-07-19  1:41       ` Andrew Morton
2007-07-19  1:50         ` Linus Torvalds
2007-07-19  2:05           ` Benjamin Herrenschmidt
2007-07-19  1:37 ` Linus Torvalds
2007-07-19  2:32   ` Jeff Garzik
2007-07-19 13:40     ` Krzysztof Halasa
2007-07-19 18:04       ` Linus Torvalds
2007-07-20 18:34         ` Krzysztof Halasa
2007-07-21  0:32           ` Benjamin Herrenschmidt
2007-07-22  4:03             ` Jeff Garzik
2007-07-22 21:29               ` Benjamin Herrenschmidt
2007-07-23  3:26         ` Kyle Moffett
2007-07-19 13:38   ` Krzysztof Halasa
2007-07-19 18:00     ` Linus Torvalds [this message]
2007-07-20 12:54       ` Tim Tassonis

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.LFD.0.999.0707191056010.27353@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=adaplas@gmail.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=jeff@garzik.org \
    --cc=khc@pm.waw.pl \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --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

all inboxes | Powered by JetHome®