From: Jens Axboe <axboe@suse.de>
To: Andries Brouwer <aebr@win.tue.nl>
Cc: Jesper Juhl <juhl-lkml@dif.dk>,
linux-kernel <linux-kernel@vger.kernel.org>,
Katrina Tsipenyuk <ytsipenyuk@fortifysoftware.com>,
katrina@fortifysoftware.com,
Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH][1/2] fix unchecked returns from kmalloc() (in kernel/module.c)
Date: Wed, 8 Dec 2004 08:01:36 +0100 [thread overview]
Message-ID: <20041208070136.GI3035@suse.de> (raw)
In-Reply-To: <20041207225741.GA4715@pclin040.win.tue.nl>
On Tue, Dec 07 2004, Andries Brouwer wrote:
> On Tue, Dec 07, 2004 at 10:29:58PM +0100, Jens Axboe wrote:
>
> > > diff -up linux-2.6.10-rc3-bk2-orig/kernel/module.c linux-2.6.10-rc3-bk2/kernel/module.c
> > > --- linux-2.6.10-rc3-bk2-orig/kernel/module.c 2004-12-06 22:24:56.000000000 +0100
> > > +++ linux-2.6.10-rc3-bk2/kernel/module.c 2004-12-07 21:17:00.000000000 +0100
> > > @@ -334,6 +334,10 @@ static int percpu_modinit(void)
> > > pcpu_num_allocated = 2;
> > > pcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated,
> > > GFP_KERNEL);
> > > + if (!pcpu_size) {
> > > + printk(KERN_ERR "Unable to allocate per-cpu memory for modules.");
> > > + return -ENOMEM;
> > > + }
> >
> > I'd say these cases are similar to SLAB_PANIC. Since it runs at boot, if
> > it fails it's likely an indication of some other problem, so dealing
> > with it here is silly. Perhaps just panic() on a NULL return.
> >
> > Both of these fortify cases aren't real problems, imho. They trip a
> > stupid (no offense to the analyzer, but it's not human :) static
> > analyzer, that's all.
>
> Hi Jens -
>
> I think I disagree a little. Experience shows that if the stupid
> static analyzer spits out a hundred complaints, there are maybe five
> real problems. If the source is not fixed in some way then the real
> problem cases drown in the noise of "harmless" warnings.
I completely agree. But that's a case of silencing the cases that aren't
interesting, so the interesting bits don't get lost in old noise.
> Remains the question how to fix the source without causing bloat by
> inserting lots of strings. Easiest is perhaps to write debug_printk()
> instead of printk() so that the string is compiled away for everyone
> except for me when I need debugging help to find out why my kernel
> does not boot.
The GFP_PANIC would at least only need one string :-)
--
Jens Axboe
next prev parent reply other threads:[~2004-12-08 7:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-07 21:23 [PATCH][1/2] fix unchecked returns from kmalloc() (in kernel/module.c) Jesper Juhl
2004-12-07 21:29 ` Jens Axboe
2004-12-07 22:56 ` Jesper Juhl
2004-12-07 22:57 ` Andries Brouwer
2004-12-08 7:01 ` Jens Axboe [this message]
2004-12-08 1:57 ` Rusty Russell
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=20041208070136.GI3035@suse.de \
--to=axboe@suse.de \
--cc=aebr@win.tue.nl \
--cc=juhl-lkml@dif.dk \
--cc=katrina@fortifysoftware.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=ytsipenyuk@fortifysoftware.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.