From: Kevin Wolf Date: Fri, 7 Feb 2014 14:35:56 +0000 (+0100) Subject: block: bdrv_aligned_pwritev: Assert overlap range X-Git-Tag: qemu-xen-4.5.0-rc1~201^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=af91f9a73c3a67eebbf4120cae62b82db8eaae19;p=qemu-upstream-4.6-testing.git block: bdrv_aligned_pwritev: Assert overlap range This adds assertions that the request that we actually end up passing to the block driver (which includes RMW data and has therefore potentially been rounded to alignment boundaries) is fully covered by the overlap_{offset,size} fields of the associated BdrvTrackedRequest. Suggested-by: Laszlo Ersek Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Laszlo Ersek --- diff --git a/block.c b/block.c index c1d1f74b8..a027823ea 100644 --- a/block.c +++ b/block.c @@ -3134,6 +3134,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, waited = wait_serialising_requests(req); assert(!waited || !req->serialising); + assert(req->overlap_offset <= offset); + assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);