From: Brian Gerst <bgerst@didntduck.org>
To: WHarms@bfs.de
Cc: kernel-janitors@lists.osdl.org, linux-kernel@vger.kernel.org
Subject: Re: mm/slab.c: linux 2.6.1 fix 2 unguarded kmalloc and a PAGE_SHIFT
Date: Sun, 25 Jan 2004 13:11:22 -0500 [thread overview]
Message-ID: <401406CA.5000107@quark.didntduck.org> (raw)
In-Reply-To: <S264257AbUAYOAm/20040125140042Z+37462@vger.kernel.org>
(Walter Harms) wrote:
> Hi list,
> this fixes catches 2 unguarded kmallocs() and changes a statement so that PAGE_SHIFT >20 causes a warning.
> At least sparc64 is prepared for a PAGE_SHIFT >20.
>
> hope that helps,
> walter
>
>
> --- mm/slab.c.org 2004-01-25 08:18:25.243165360 +0100
> +++ mm/slab.c 2004-01-25 08:33:05.135401408 +0100
> @@ -666,7 +666,7 @@
> * Fragmentation resistance on low memory - only use bigger
> * page orders on machines with more than 32MB of memory.
> */
> - if (num_physpages > (32 << 20) >> PAGE_SHIFT)
> + if (num_physpages > (32 << (20-PAGE_SHIFT) )
> slab_break_gfp_order = BREAK_GFP_ORDER_HI;
>
>
> @@ -737,6 +737,10 @@
> void * ptr;
>
> ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
> +
> + if (!ptr)
> + BUG();
> +
> local_irq_disable();
> BUG_ON(ac_data(&cache_cache) != &initarray_cache.cache);
> memcpy(ptr, ac_data(&cache_cache), sizeof(struct arraycache_init
> ));
> @@ -744,6 +748,10 @@
> local_irq_enable();
>
> ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
> +
> + if (!ptr)
> + BUG();
> +
> local_irq_disable();
> BUG_ON(ac_data(malloc_sizes[0].cs_cachep) != &initarray_generic.
> cache);
> memcpy(ptr, ac_data(malloc_sizes[0].cs_cachep),
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
BUG_ON(!ptr) would be better.
--
Brian Gerst
next prev parent reply other threads:[~2004-01-25 18:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-25 14:02 Walter Harms
2004-01-25 18:11 ` Brian Gerst [this message]
2004-01-25 18:16 Manfred Spraul
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=401406CA.5000107@quark.didntduck.org \
--to=bgerst@didntduck.org \
--cc=WHarms@bfs.de \
--cc=kernel-janitors@lists.osdl.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
Powered by JetHome