* [PATCH 0/1] Fix kconfig core dumps running make oldconfig
@ 2010-11-01 21:01 Andy Whitcroft
2010-11-01 21:01 ` [PATCH 1/1] kconfig: sym_expand_string_value: allow for string termination when reallocing Andy Whitcroft
0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2010-11-01 21:01 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andy Whitcroft, linux-kbuild, linux-kernel
When running make oldconfig cirtain configurations kconfig will coredump.
This is triggered by an issue calculating the length of the result of
expanding symbol values containing variables. This prevents builds on
these configs.
This bug was exposed by the commit below which _correctly_ fixed the
usage of realloc():
commit 19c29f326075e2c66e34d98f2a0cf22901b2d8e9
Author: Michal Marek <mmarek@suse.cz>
Date: Thu Sep 30 22:21:12 2010 +0200
kconfig: Fix realloc usage()
-apw
Andy Whitcroft (1):
kconfig: sym_expand_string_value: allow for string termination when
reallocing
scripts/kconfig/symbol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/1] kconfig: sym_expand_string_value: allow for string termination when reallocing
2010-11-01 21:01 [PATCH 0/1] Fix kconfig core dumps running make oldconfig Andy Whitcroft
@ 2010-11-01 21:01 ` Andy Whitcroft
2010-11-25 14:23 ` Michal Marek
0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2010-11-01 21:01 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andy Whitcroft, linux-kbuild, linux-kernel
When expanding a parameterised string we may run out of space, this
triggers a realloc. When computing the new allocation size we do not allow
for the terminating '\0'. Allow for this when calculating the new length.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
scripts/kconfig/symbol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index c0efe10..af6e9f3 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -875,7 +875,7 @@ const char *sym_expand_string_value(const char *in)
symval = sym_get_string_value(sym);
}
- newlen = strlen(res) + strlen(symval) + strlen(src);
+ newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
if (newlen > reslen) {
reslen = newlen;
res = realloc(res, reslen);
--
1.7.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] kconfig: sym_expand_string_value: allow for string termination when reallocing
2010-11-01 21:01 ` [PATCH 1/1] kconfig: sym_expand_string_value: allow for string termination when reallocing Andy Whitcroft
@ 2010-11-25 14:23 ` Michal Marek
0 siblings, 0 replies; 3+ messages in thread
From: Michal Marek @ 2010-11-25 14:23 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: Linus Torvalds, linux-kbuild, linux-kernel
On Mon, Nov 01, 2010 at 09:01:44PM +0000, Andy Whitcroft wrote:
> When expanding a parameterised string we may run out of space, this
> triggers a realloc. When computing the new allocation size we do not allow
> for the terminating '\0'. Allow for this when calculating the new length.
>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
> scripts/kconfig/symbol.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Applied to kbuild-2.6.git#rc-fixes, thanks.
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-25 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-01 21:01 [PATCH 0/1] Fix kconfig core dumps running make oldconfig Andy Whitcroft
2010-11-01 21:01 ` [PATCH 1/1] kconfig: sym_expand_string_value: allow for string termination when reallocing Andy Whitcroft
2010-11-25 14:23 ` Michal Marek
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®