[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qemu-nbd: Shrink image size by specified of
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qemu-nbd: Shrink image size by specified offset |
Date: |
Tue, 20 Sep 2016 09:09:59 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 09/20/2016 04:37 AM, Tomáš Golembiovský wrote:
[meta-comment]: Your series came through without any threading (you sent
three threads, instead of patch 1 and 2 being marked In-Reply-To the 0/2
cover letter).
> When --offset is set the apparent device size has to be adjusted
> accordingly. Otherwise client may request read/write beyond the file end
> which would fail.
>
> Signed-off-by: Tomáš Golembiovský <address@hidden>
> ---
> qemu-nbd.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/qemu-nbd.c b/qemu-nbd.c
> index 99297a5..629bce1 100644
> --- a/qemu-nbd.c
> +++ b/qemu-nbd.c
> @@ -901,6 +901,13 @@ int main(int argc, char **argv)
> exit(EXIT_FAILURE);
> }
Additional context:
off_t dev_offset = 0;
off_t fd_size;
>
> + if (dev_offset >= fd_size) {
> + error_report("Offset (%lu) has to be smaller than the image size
> (%lu)",
> + dev_offset, fd_size);
Whoops, this fails to compile on 32-bit platforms. %lu is not
necessarily synonymous with off_t values.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature