qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH] block/vpc.c: Handle write failures in get_image


From: Kevin Wolf
Subject: Re: [Qemu-block] [PATCH] block/vpc.c: Handle write failures in get_image_offset()
Date: Thu, 13 Jul 2017 14:32:25 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 09.07.2017 um 23:07 hat Peter Maydell geschrieben:
> Coverity (CID 1355236) points out that get_image_offset() doesn't check that
> it actually succeeded in writing the updated block bitmap to the file.
> Check the error return from bdrv_pwrite_sync() and propagate an error
> response back up to the function which calls get_image_offset() for
> a write so that it can return the error to its caller.
> 
> get_sector_offset() is only used for reads, but we move it to the
> same API for consistency.
> Signed-off-by: Peter Maydell <address@hidden>

Thanks, applied to the block branch.

> The new get_image_offset() API is pretty clunky, but I couldn't
> think of anything better -- we need to report one of 3 things:
>  * offset number (0..INT64_MAX)
>  * sector not allocated
>  * arbitrary errno
> and they won't all fit into one return value.
> I opted for "minimal change compared to current code".

Good enough for vpc. I guess I would have chosen to return the offset by
reference and use the actual return value for 1=allocated, 0=unallocated
and -errno on error.

get_sector_offset() has two useless parameters now instead of one, but
I'll just send a patch on top to remove them.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]