linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: Christoph Lameter <clameter@engr.sgi.com>
Cc: linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH] __kmalloc: Generate BUG if size requested is too large.
Date: Thu, 22 Sep 2005 13:31:00 -0700	[thread overview]
Message-ID: <1127421060.10664.76.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.62.0509221232140.17975@schroedinger.engr.sgi.com>

On Thu, 2005-09-22 at 12:32 -0700, Christoph Lameter wrote:
> I had an issue on ia64 where I got a bug in kernel/workqueue because kzalloc
> returned a NULL pointer due to the task structure getting too big for the slab
> allocator. Usually these cases are caught by the kmalloc macro in include/linux/slab.h.
> Compilation will fail if a too big value is passed to kmalloc.

I'd be more concerned that the workqueue code wasn't checking for NULL.
Also, the one place where I see the workqueue code using kzalloc(), it
checks for kzalloc() failure (in __create_workqueue).

> However, kzalloc uses __kmalloc which has no check for that. This
> patch makes __kmalloc bug if a too large entity is requested.

I don't see that in current -git, either.  Which version of the kernel
are you working against?

> void *kzalloc(size_t size, unsigned int __nocast flags)
> {
>         void *ret = kmalloc(size, flags);
>         if (ret)
>                 memset(ret, 0, size);
>         return ret;
> }
> EXPORT_SYMBOL(kzalloc);

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2005-09-22 20:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-22 19:32 Christoph Lameter
2005-09-22 20:31 ` Dave Hansen [this message]
2005-09-22 20:54   ` Christoph Lameter

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=1127421060.10664.76.camel@localhost \
    --to=haveblue@us.ibm.com \
    --cc=clameter@engr.sgi.com \
    --cc=linux-mm@kvack.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