Skip to contentSkip to conversation

Fix kconfig core dumps running make oldconfig

PATCH In review Andy Whitcroft 2 participants 3 messages Nov 1, 2010 – Nov 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fix kconfig core dumps running make oldconfig

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 <[email protected]>
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(-)
#1 lore raw

PATCH 1/1 kconfig: sym_expand_string_value: allow for string termination when reallocing

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.

---
 scripts/kconfig/symbol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/symbol.c +1 -1
index c0efe10..af6e9f3 100644
@@ -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);
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/1] kconfig: sym_expand_string_value: allow for string termination when reallocing

Quoted 8 lines · Andy Whitcroft

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.

---
 scripts/kconfig/symbol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied to kbuild-2.6.git#rc-fixes, thanks.

Michal