Patchwork [1/5] blockdev: Fix error message for invalid -drive CHS

login
register
mail settings
Submitter Markus Armbruster
Date Jan. 17, 2011, 6:31 p.m.
Message ID <1295289090-18236-2-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/79208/
State New
Headers show

Comments

Markus Armbruster - Jan. 17, 2011, 6:31 p.m.
When cyls, heads or secs are out of range, the error message prints
buf, which points to the value of option "if".  Bogus, may even be
null.  Drop that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 blockdev.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/blockdev.c b/blockdev.c
index d7add36..b01a87c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -224,15 +224,15 @@  DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error)
 
     if (cyls || heads || secs) {
         if (cyls < 1 || (type == IF_IDE && cyls > 16383)) {
-            fprintf(stderr, "qemu: '%s' invalid physical cyls number\n", buf);
+            fprintf(stderr, "qemu: invalid physical cyls number\n");
 	    return NULL;
 	}
         if (heads < 1 || (type == IF_IDE && heads > 16)) {
-            fprintf(stderr, "qemu: '%s' invalid physical heads number\n", buf);
+            fprintf(stderr, "qemu: invalid physical heads number\n");
 	    return NULL;
 	}
         if (secs < 1 || (type == IF_IDE && secs > 63)) {
-            fprintf(stderr, "qemu: '%s' invalid physical secs number\n", buf);
+            fprintf(stderr, "qemu: invalid physical secs number\n");
 	    return NULL;
 	}
     }