mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: akpm@zip.com.au
Cc: linux-kernel@vger.kernel.org
Subject: kmalloc() fix^2
Date: Thu, 10 Apr 2003 14:50:50 -0700	[thread overview]
Message-ID: <16021.59194.847626.480618@napali.hpl.hp.com> (raw)

It's all very embarassing, but my previous patch was horribly broken:
it added the NULL terminator to the wrong array...  Of course, adding
it to the correct array uncovered another bug... ;-(

Patch below fixes both problems.  Reall, I mean it.

Andrew, you may want to double-check---I didn't look through all of
slab.c whether there might be problems (there was no other mention of
ARRAY_SIZE(malloc_sizes) though.

Thanks,

	--david

===== mm/slab.c 1.74 vs edited =====
--- 1.74/mm/slab.c	Wed Apr  9 13:28:18 2003
+++ edited/mm/slab.c	Thu Apr 10 14:43:44 2003
@@ -383,6 +383,7 @@
 } malloc_sizes[] = {
 #define CACHE(x) { .cs_size = (x) },
 #include <linux/kmalloc_sizes.h>
+	{0, }
 #undef CACHE
 };
 
@@ -393,7 +394,6 @@
 } cache_names[] = {
 #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
 #include <linux/kmalloc_sizes.h>
-	{ 0, }
 #undef CACHE
 };
 
@@ -604,7 +604,7 @@
 	if (num_physpages > (32 << 20) >> PAGE_SHIFT)
 		slab_break_gfp_order = BREAK_GFP_ORDER_HI;
 
-	for (i = 0; i < ARRAY_SIZE(malloc_sizes); i++) {
+	for (i = 0; i < ARRAY_SIZE(malloc_sizes) - 1; i++) {
 		struct cache_sizes *sizes = malloc_sizes + i;
 		/* For performance, all the general caches are L1 aligned.
 		 * This should be particularly beneficial on SMP boxes, as it

             reply	other threads:[~2003-04-10 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-10 21:50 David Mosberger [this message]
2003-04-11  0:04 ` Brian Gerst

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=16021.59194.847626.480618@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=akpm@zip.com.au \
    --cc=davidm@hpl.hp.com \
    --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®