From: Parag Warudkar <parag.warudkar@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, akpm@linux-foundation.org,
torvalds@linux-foundation.org, ak@suse.de
Subject: [PATCH] x86: Fix dmi_alloc() to not advance alloc index in case of failure
Date: Tue, 18 Dec 2007 19:45:18 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0712181937560.3616@mini.warudkars.net> (raw)
dmi_alloc() for CONFIG_X86_64 is defined to allocate from a static array
and it maintains a allocation index which is advanced each time allocation
is attempted - it gets incremented even if an allocation fails thereby
depriving any future request that may be small enough to be satisfied from
the array.
Fix this by first testing if allocation is going to be possible and
incrementing alloc index only then.
Signed-off-by: Parag Warudkar <parag.warudkar@gmail.com>
--- linux-2.6/include/asm-x86/dmi.h 2007-12-07 10:04:42.000000000 -0500
+++ linux-2.6-work/include/asm-x86/dmi.h 2007-12-18 18:08:42.000000000 -0500
@@ -22,8 +22,9 @@
static inline void *dmi_alloc(unsigned len)
{
int idx = dmi_alloc_index;
- if ((dmi_alloc_index += len) > DMI_MAX_DATA)
+ if ((dmi_alloc_index + len) > DMI_MAX_DATA)
return NULL;
+ dmi_alloc_index += len;
return dmi_alloc_data + idx;
}
next reply other threads:[~2007-12-19 0:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-19 0:45 Parag Warudkar [this message]
2007-12-19 10:50 ` Ingo Molnar
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=Pine.LNX.4.64.0712181937560.3616@mini.warudkars.net \
--to=parag.warudkar@gmail.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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®