mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Matthew Wilcox <matthew@wil.cx>,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH]use kzalloc in vfs where appropriate
Date: Sun, 19 Mar 2006 14:29:21 +0100	[thread overview]
Message-ID: <200603191429.21776.oliver@neukum.org> (raw)
In-Reply-To: <1142679326.2889.20.camel@laptopd505.fenrus.org>

Am Samstag, 18. März 2006 11:55 schrieb Arjan van de Ven:
> On Sat, 2006-03-18 at 11:44 +0100, Oliver Neukum wrote:
> > Am Freitag, 17. März 2006 22:08 schrieb Matthew Wilcox:
> > > On Fri, Mar 17, 2006 at 09:58:14PM +0100, Oliver Neukum wrote:
> > > > --- a/fs/bio.c	2006-03-11 23:12:55.000000000 +0100
> > > > +++ b/fs/bio.c	2006-03-17 16:44:49.000000000 +0100
> > > > @@ -635,12 +635,10 @@
> > > >  		return ERR_PTR(-ENOMEM);
> > > >  
> > > >  	ret = -ENOMEM;
> > > > -	pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
> > > > +	pages = kzalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
> > > 
> > > Didn't we just discuss this one and conclude it needed to use kcalloc
> > > instead?
> > 
> > I've found some discussion in the archive, but no conclusion. Could you
> > elaborate?
> 
> kcalloc is the array allocator.
> Here.. you're allocating an array of nr_pages worth of pointers.
> kcalloc does extra checks because it KNOWS it's an array...

I see. A patch is coming.
Shouldn't this check from slab.h:

	if (n != 0 && size > INT_MAX / n)
		return NULL;

carry an "unlikely"?

	Regards
		Oliver

  reply	other threads:[~2006-03-19 13:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-17 20:58 Oliver Neukum
2006-03-17 21:08 ` Matthew Wilcox
2006-03-18 10:44   ` Oliver Neukum
2006-03-18 10:55     ` Arjan van de Ven
2006-03-19 13:29       ` Oliver Neukum [this message]
2006-03-19 16:09         ` Arjan van de Ven
2006-03-19 20:50           ` Oliver Neukum
2006-03-20  7:25             ` Pekka Enberg
2006-03-20 12:52               ` Oliver Neukum
2006-03-20 13:08               ` Denis Vlasenko
2006-03-20 13:14                 ` Oliver Neukum
2006-03-20 13:23                   ` Pekka J Enberg
2006-03-20 13:16                 ` Pekka J Enberg

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=200603191429.21776.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=arjan@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=viro@zeniv.linux.org.uk \
    /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

Powered by JetHome