Skip to contentSkip to conversation

Block patches for 2.6

GIT PULL Applied Jeff Cody 2 participants 4 messages Mar 16, 2016 – Mar 17, 2016 Block layer

lore
Share & tools
lore

Jeff Cody

author
#0 lore raw

The following changes since commit 0ebc03bc065329eaefb6493f5fa7df08df528f2a:

util/base64.c: Clean includes (2016-03-16 12:48:11 +0000)

are available in the git repository at:

[email protected]:codyprime/qemu-kvm-jtc.git tags/block-pull-request

for you to fetch changes up to 773460256bb65b7ef5948cedc31aa8bc889ac86f:

MAINTAINERS: Fix typo, block/stream.h -> block/stream.c (2016-03-16 13:25:29 -0400)

----------------------------------------------------------------
Block patches for 2.6
----------------------------------------------------------------

Jeff Cody (2):
block/sheepdog: fix argument passed to qemu_strtoul()
MAINTAINERS: Fix typo, block/stream.h -> block/stream.c

 MAINTAINERS      |  2 +-
 block/sheepdog.c | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.3
author
#1 lore raw

[Qemu-devel] [PULL 2/2] MAINTAINERS: Fix typo, block/stream.h -> block/stream.c

There is no block/stream.h, the intended filename is block/stream.c instead.

Message-id: b9feeac95301c1b0b1c28a485da5e3781370c31a.1457578261.git.jcody@redhat.com

---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index 87ddace..afbe845 100644
@@ -1016,7 +1016,7 @@ F: blockjob.c
 F: include/block/blockjob.h
 F: block/backup.c
 F: block/commit.c
-F: block/stream.h
+F: block/stream.c
 F: block/mirror.c
 T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
Signature · 1 line
1.9.3
author
#2 lore raw

[Qemu-devel] [PULL 1/2] block/sheepdog: fix argument passed to qemu_strtoul()

In reply to Jeff Cody

The function qemu_strtoul() reads 'unsigned long' sized data, which is larger than uint32_t on 64-bit machines.

Even though the snap_id field in the header is 32-bits, we must accommodate the full size in qemu_strtoul().

This patch also adds more meaningful error handling to the qemu_strtoul() call, and subsequent results.

Message-id: e56fc50abedd9a112e0683342c8eafda063cd2f9.1456935548.git.jcody@redhat.com

---
 block/sheepdog.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
block/sheepdog.c +7 -4
index a6e98a5..06ae3ba 100644
@@ -2549,7 +2549,7 @@ static int sd_snapshot_delete(BlockDriverState *bs,
                               const char *name,
                               Error **errp)
 {
-    uint32_t snap_id = 0;
+    unsigned long snap_id = 0;
     char snap_tag[SD_MAX_VDI_TAG_LEN];
     Error *local_err = NULL;
     int fd, ret;
@@ -2571,12 +2571,15 @@ static int sd_snapshot_delete(BlockDriverState *bs,
     memset(buf, 0, sizeof(buf));
     memset(snap_tag, 0, sizeof(snap_tag));
     pstrcpy(buf, SD_MAX_VDI_LEN, s->name);
-    if (qemu_strtoul(snapshot_id, NULL, 10, (unsigned long *)&snap_id)) {
-        return -1;
+    ret = qemu_strtoul(snapshot_id, NULL, 10, &snap_id);
+    if (ret || snap_id > UINT32_MAX) {
+        error_setg(errp, "Invalid snapshot ID: %s",
+                         snapshot_id ? snapshot_id : "<null>");
+        return -EINVAL;
     }
 
     if (snap_id) {
-        hdr.snapid = snap_id;
+        hdr.snapid = (uint32_t) snap_id;
     } else {
         pstrcpy(snap_tag, sizeof(snap_tag), snapshot_id);
         pstrcpy(buf + SD_MAX_VDI_LEN, SD_MAX_VDI_TAG_LEN, snap_tag);
Signature · 1 line
1.9.3
#3 lore raw
In reply to Jeff Cody
Quoted 8 lines · Jeff Cody

The following changes since commit 0ebc03bc065329eaefb6493f5fa7df08df528f2a:

util/base64.c: Clean includes (2016-03-16 12:48:11 +0000)

are available in the git repository at:

[email protected]:codyprime/qemu-kvm-jtc.git tags/block-pull-request

Quoted 8 lines

for you to fetch changes up to 773460256bb65b7ef5948cedc31aa8bc889ac86f:

MAINTAINERS: Fix typo, block/stream.h -> block/stream.c (2016-03-16 13:25:29 -0400)

----------------------------------------------------------------
Block patches for 2.6
----------------------------------------------------------------

Applied, thanks.

-- PMM