All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Krempa <pkrempa@redhat.com>
To: qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>, Peter Krempa <pkrempa@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] vl.c: Fix error messages when parsing maxmem parameters
Date: Mon, 26 Jan 2015 16:31:31 +0100	[thread overview]
Message-ID: <b16e337156de7bf76ec4496ad933d8407d394d98.1422285793.git.pkrempa@redhat.com> (raw)
In-Reply-To: <cover.1422285793.git.pkrempa@redhat.com>
In-Reply-To: <cover.1422285793.git.pkrempa@redhat.com>

Produce more human readable error messages and fix few spelling
mistakes.

Also remove a redundant check for the max memory size.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 vl.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/vl.c b/vl.c
index 983259b..cdc920c 100644
--- a/vl.c
+++ b/vl.c
@@ -2694,29 +2694,21 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size)
         uint64_t slots;

         sz = qemu_opt_get_size(opts, "maxmem", 0);
-        if (sz < ram_size) {
-            error_report("invalid -m option value: maxmem "
-                    "(0x%" PRIx64 ") <= initial memory (0x"
-                    RAM_ADDR_FMT ")", sz, ram_size);
+        if (sz <= ram_size) {
+            error_report("invalid value of -m option maxmem: "
+                         "maximum memory size (0x%" PRIx64 ") must be greater "
+                         "than initial memory size (0x"  RAM_ADDR_FMT ")",
+                         sz, ram_size);
             exit(EXIT_FAILURE);
         }

         slots = qemu_opt_get_number(opts, "slots", 0);
         if ((sz > ram_size) && !slots) {
-            error_report("invalid -m option value: maxmem "
-                    "(0x%" PRIx64 ") more than initial memory (0x"
-                    RAM_ADDR_FMT ") but no hotplug slots where "
-                    "specified", sz, ram_size);
+            error_report("invalid value of -m option: maxmem was specified, "
+                         "but no hotplug slots were specified");
             exit(EXIT_FAILURE);
         }

-        if ((sz <= ram_size) && slots) {
-            error_report("invalid -m option value:  %"
-                    PRIu64 " hotplug slots where specified but "
-                    "maxmem (0x%" PRIx64 ") <= initial memory (0x"
-                    RAM_ADDR_FMT ")", slots, sz, ram_size);
-            exit(EXIT_FAILURE);
-        }
         *maxram_size = sz;
         *ram_slots = slots;
     } else if ((!maxmem_str && slots_str) ||
-- 
2.2.1

  reply	other threads:[~2015-01-26 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 15:31 [Qemu-devel] [PATCH 0/2] pc: Fix startup with memory hotplug enabled Peter Krempa
2015-01-26 15:31 ` Peter Krempa [this message]
2015-01-27 18:15   ` [Qemu-devel] [PATCH 1/2] vl.c: Fix error messages when parsing maxmem parameters Eric Blake
2015-01-28  7:18     ` Peter Krempa
2015-01-26 15:31 ` [Qemu-devel] [PATCH 2/2] pc: memory: Validate alignment of maxram_size to page size Peter Krempa
2015-01-27 18:16   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b16e337156de7bf76ec4496ad933d8407d394d98.1422285793.git.pkrempa@redhat.com \
    --to=pkrempa@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.