From 45ddea1cdda3ead33c425da69a9e261d45f227b8 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sun, 19 Jun 2005 23:16:08 +0000 Subject: [PATCH] Fixed bug that caused the PM to brutalize the contents of the 'memory' variable. Parsing worked, but future requests for the variable (such as by the sysenv command) returned truncated data. This caused the system (e.g. setup script) to think the amount of memory was tiny, and caused the enabling of swapspace, while it is unnecessary. --- servers/pm/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/servers/pm/main.c b/servers/pm/main.c index 990a3d8d3..5eb0fc2e3 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -256,7 +256,7 @@ struct memory *mem_chunks; /* store mem chunks here */ */ long base, size, limit; char *s, *end; /* use to parse boot variable */ - int i; + int i, done = 0; struct memory *memp; #if _WORD_SIZE == 2 unsigned long max_address; @@ -278,7 +278,7 @@ struct memory *mem_chunks; /* store mem chunks here */ * and b2:s2 are combined if the memory is adjacent. */ s = find_param("memory"); /* get memory boot variable */ - for (i = 0; i < NR_MEMS; i++) { + for (i = 0; i < NR_MEMS && !done; i++) { memp = &mem_chunks[i]; /* next mem chunk is stored here */ base = size = 0; /* initialize next base:size pair */ if (*s != 0) { /* get fresh data, unless at end */ @@ -291,7 +291,7 @@ struct memory *mem_chunks; /* store mem chunks here */ /* Read fresh size and expect comma or assume end. */ size = strtoul(s, &end, 0x10); /* get number */ if (end != s && *end == ',') s = ++end; /* skip ',' */ - else *s=0; /* found end */ + else done = 1; } limit = base + size; #if _WORD_SIZE == 2