vl.c: Keep maxram_size and ram_size consistent unless specified otherwise
PATCH 1/1 vl.c: Keep maxram_size and ram_size consistent unless specified otherwise
When using a memory size less than the default amount with older pc machine types, a failure occurs because of the way maxram_size and ram_size get initialized. Keep maxram_size and ram_size the same, except when maxmem is specified on the command line.
--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +1 -1
@@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp) RAM_ADDR_FMT ")\n", slots, sz, ram_size);exit (EXIT_FAILURE ); } - maxram_size = sz; ram_slots = slots; }else if ((!maxmem_str && slots_str) || (maxmem_str && !slots_str)) {
@@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp) "'%s' option\n", slots_str ? "maxmem" : "slots");exit (EXIT_FAILURE ); } + maxram_size = sz;break ; }#ifdef CONFIG_TPM
Signature · 1 line
1.9.0
Quoted 23 lines · On Mon, 7 Jul 2014 17:05:22 -0600 Bruce Rogers <[email protected]> wrote:
When using a memory size less than the default amount with older pc machine types, a failure occurs because of the way
maxram_sizeandram_sizeget initialized. Keepmaxram_sizeandram_sizethe same, except when maxmem is specified on the command line.Signed-off-by Bruce Rogers <[email protected]>--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)vl.c +0
-1@@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp)RAM_ADDR_FMT ")\n" , slots, sz, ram_size); exit(EXIT_FAILURE); } - maxram_size = sz; ram_slots = slots; }else if ((!maxmem_str && slots_str) || (maxmem_str && !slots_str)) {
vl.c int main(int argc, char **argv, char **envp) · line 3355
Quoted 4 lines
vl.c +1
-0@@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp)"'%s' option\n" , slots_str ?"maxmem" : "slots"); exit(EXIT_FAILURE); } + maxram_size = sz;
Relying here on sz being either ram_size or maxmem is a bit fragile. It'd be better to set maxram_size to ram_size before parsing maxmem.
I'll post alternative patch.
Quoted 3 lines
vl.c +0
-0break ; }#ifdef CONFIG_TPM
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 7/8/2014 at 07:23 AM, <[email protected]> wrote:
Quoted 23 lines · On Mon, 7 Jul 2014 17:05:22 -0600 Bruce Rogers <[email protected]> wrote:
When using a memory size less than the default amount with older pc machine types, a failure occurs because of the way
maxram_sizeandram_sizeget initialized. Keepmaxram_sizeandram_sizethe same, except when maxmem is specified on the command line.Signed-off-by Bruce Rogers <[email protected]>--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)vl.c +0
-1@@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp)RAM_ADDR_FMT ")\n" , slots, sz, ram_size); exit(EXIT_FAILURE); } - maxram_size = sz; ram_slots = slots; }else if ((!maxmem_str && slots_str) || (maxmem_str && !slots_str)) {vl.c int main(int argc, char **argv, char **envp) · line 3355
Quoted 4 lines
vl.c +1
-0@@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp)"'%s' option\n" , slots_str ?"maxmem" : "slots"); exit(EXIT_FAILURE); } + maxram_size = sz;Relying here on sz being either
ram_sizeor maxmem is a bit fragile. It'd be better to setmaxram_sizetoram_sizebefore parsing maxmem.
Quoted 5 lines
I'll post alternative patch.
Quoted 3 lines
vl.c +0
-0break ; }#ifdef CONFIG_TPM
Either way is fine with me.
Thanks
Bruce