|
|
9ae3a8 |
From 862f45e0ad5a70d10bffa435d5331c444874e4d2 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 23 Nov 2015 17:38:23 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 04/27] qemu-io: Handle cvtnum() errors in 'alloc'
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1448300320-7772-5-git-send-email-jsnow@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 68431
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 04/21] qemu-io: Handle cvtnum() errors in 'alloc'
|
|
|
9ae3a8 |
Bugzilla: 1272523
|
|
|
9ae3a8 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit cf49a6a00c19cabf4006d4f82bef26345043e7b5)
|
|
|
9ae3a8 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-io.c | 9 ++++++++-
|
|
|
9ae3a8 |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/qemu-io.c b/qemu-io.c
|
|
|
9ae3a8 |
index 3b5890e..e4fa2fc 100644
|
|
|
9ae3a8 |
--- a/qemu-io.c
|
|
|
9ae3a8 |
+++ b/qemu-io.c
|
|
|
9ae3a8 |
@@ -1608,7 +1608,10 @@ static int alloc_f(int argc, char **argv)
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
offset = cvtnum(argv[1]);
|
|
|
9ae3a8 |
- if (offset & 0x1ff) {
|
|
|
9ae3a8 |
+ if (offset < 0) {
|
|
|
9ae3a8 |
+ printf("non-numeric offset argument -- %s\n", argv[1]);
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ } else if (offset & 0x1ff) {
|
|
|
9ae3a8 |
printf("offset %" PRId64 " is not sector aligned\n",
|
|
|
9ae3a8 |
offset);
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
@@ -1616,6 +1619,10 @@ static int alloc_f(int argc, char **argv)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (argc == 3) {
|
|
|
9ae3a8 |
nb_sectors = cvtnum(argv[2]);
|
|
|
9ae3a8 |
+ if (nb_sectors < 0) {
|
|
|
9ae3a8 |
+ printf("non-numeric length argument -- %s\n", argv[2]);
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
nb_sectors = 1;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|