* [Qemu-devel] [PULL 0/2] Block patches for 2.6
@ 2016-03-16 17:38 Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 1/2] block/sheepdog: fix argument passed to qemu_strtoul() Jeff Cody
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jeff Cody @ 2016-03-16 17:38 UTC (permalink / raw)
To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel
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:
git@github.com: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(-)
--
1.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PULL 1/2] block/sheepdog: fix argument passed to qemu_strtoul()
2016-03-16 17:38 [Qemu-devel] [PULL 0/2] Block patches for 2.6 Jeff Cody
@ 2016-03-16 17:38 ` Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 2/2] MAINTAINERS: Fix typo, block/stream.h -> block/stream.c Jeff Cody
2016-03-17 8:52 ` [Qemu-devel] [PULL 0/2] Block patches for 2.6 Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Cody @ 2016-03-16 17:38 UTC (permalink / raw)
To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel
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.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Message-id: e56fc50abedd9a112e0683342c8eafda063cd2f9.1456935548.git.jcody@redhat.com
---
block/sheepdog.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index a6e98a5..06ae3ba 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -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);
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PULL 2/2] MAINTAINERS: Fix typo, block/stream.h -> block/stream.c
2016-03-16 17:38 [Qemu-devel] [PULL 0/2] Block patches for 2.6 Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 1/2] block/sheepdog: fix argument passed to qemu_strtoul() Jeff Cody
@ 2016-03-16 17:38 ` Jeff Cody
2016-03-17 8:52 ` [Qemu-devel] [PULL 0/2] Block patches for 2.6 Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Cody @ 2016-03-16 17:38 UTC (permalink / raw)
To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel
There is no block/stream.h, the intended filename is block/stream.c
instead.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: b9feeac95301c1b0b1c28a485da5e3781370c31a.1457578261.git.jcody@redhat.com
---
MAINTAINERS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 87ddace..afbe845 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PULL 0/2] Block patches for 2.6
2016-03-16 17:38 [Qemu-devel] [PULL 0/2] Block patches for 2.6 Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 1/2] block/sheepdog: fix argument passed to qemu_strtoul() Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 2/2] MAINTAINERS: Fix typo, block/stream.h -> block/stream.c Jeff Cody
@ 2016-03-17 8:52 ` Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-03-17 8:52 UTC (permalink / raw)
To: Jeff Cody; +Cc: QEMU Developers, Qemu-block
On 16 March 2016 at 17:38, Jeff Cody <jcody@redhat.com> wrote:
> 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:
>
> git@github.com: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
> ----------------------------------------------------------------
>
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-17 8:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 17:38 [Qemu-devel] [PULL 0/2] Block patches for 2.6 Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 1/2] block/sheepdog: fix argument passed to qemu_strtoul() Jeff Cody
2016-03-16 17:38 ` [Qemu-devel] [PULL 2/2] MAINTAINERS: Fix typo, block/stream.h -> block/stream.c Jeff Cody
2016-03-17 8:52 ` [Qemu-devel] [PULL 0/2] Block patches for 2.6 Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).