Skip to contentSkip to conversation

Fix parse_size_and_unit() breakage in xen-3.0.4-testing (kdump broken)

PATCH Applied Magnus Damm 4 participants 4 messages Jan 10, 2007 – Jan 11, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix parse_size_and_unit() breakage in xen-3.0.4-testing (kdump broken)

Fix parse_size_and_unit() breakage in xen-3.0.4-testing (kdump broken)

Kdump has been broken since xen-3.0.4-testing.hg-13109. Many thanks to Hiromichi Itou for tracking this down.

---

Applies to xen-3.0.4-testing-13130.

xen/common/lib.c +2 -2
@@ -442,7 +442,7 @@ s64 __moddi3(s64 a, s64 b)
 unsigned long long parse_size_and_unit(const char *s, const char **ps)
 {
 	unsigned long long ret;
-	const char *s1;
+	const char *s1 = NULL;
 
 	ret = simple_strtoull(s, &s1, 0);
 
@@ -454,7 +454,7 @@ unsigned long long parse_size_and_unit(c
 	case 'K': case 'k':
 		ret <<= 10;
 	case 'B': case 'b':
-		s++;
+		s1++;
 		break;
 	default:
 		ret <<= 10; /* default to kB */
Applied
#1 lore raw
Quoted 6 lines · Magnus Damm

Fix parse_size_and_unit() breakage in xen-3.0.4-testing (kdump broken)

Kdump has been broken since xen-3.0.4-testing.hg-13109. Many thanks to Hiromichi Itou for tracking this down.

I applied a similar fix to xen-unstable.hg in 13282:9865145e53eb. I'll get it pulled into xen-3.0.4-testing.hg.

xen/common/lib.c s64 __moddi3(s64 a, s64 b) · line 447

Quoted 10 lines
xen/common/lib.c +1 -1
@@ -442,7 +442,7 @@ s64 __moddi3(s64 a, s64 b)
 unsigned long long parse_size_and_unit(const char *s, const char **ps)
 {
 	unsigned long long ret;
-	const char *s1;
+	const char *s1 = NULL;
 
 	ret = simple_strtoull(s, &s1, 0);

Are you sure this bit is necessary? simple_strtoull always initialises &s1.

Ian.

#3 lore raw
In reply to Magnus Damm
Quoted 11 lines

Fix parse_size_and_unit() breakage in xen-3.0.4-testing (kdump broken)

Kdump has been broken since xen-3.0.4-testing.hg-13109. Many thanks to Hiromichi Itou for tracking this down.

---

Applies to xen-3.0.4-testing-13130.

Applied (second hunk only to minimize diff w/ -unstable).

thanks,

S.

#2 lore raw
In reply to Ian Campbell
Quoted 10 lines · Ian Campbell
Quoted 6 lines · Magnus Damm

Fix parse_size_and_unit() breakage in xen-3.0.4-testing (kdump broken)

Kdump has been broken since xen-3.0.4-testing.hg-13109. Many thanks to Hiromichi Itou for tracking this down.

I applied a similar fix to xen-unstable.hg in 13282:9865145e53eb. I'll get it pulled into xen-3.0.4-testing.hg.

Great, thanks.

Quoted 9 lines
Quoted 9 lines
xen/common/lib.c 2007-01-10 11:18:38.000000000 +0900 renamed from xen/common/lib.c +1 -1
@@ -442,7 +442,7 @@ s64 __moddi3(s64 a, s64 b)
 unsigned long long parse_size_and_unit(const char *s, const char **ps)
 {
      unsigned long long ret;
-     const char *s1;
+     const char *s1 = NULL;
 
Quoted 4 lines

xen/common/lib.c 2007-01-10 11:18:38.000000000 +0900 s64 __moddi3(s64 a, s64 b) · line 447

Quoted 1 line
xen/common/lib.c 2007-01-10 11:18:38.000000000 +0900 renamed from xen/common/lib.c +0 -0
      ret = simple_strtoull(s, &s1, 0);

Are you sure this bit is necessary? simple_strtoull always initialises &s1.

Probably no, but the reason why I put it there is that we would be sure to crash if someone happened to change simple_strtoull(). If simple_strtoull() would forget to write s1 then today we may get silent errors where switch (*s1) is used on an uninitialized variable.

/ magnus