From: Ian Jackson Date: Tue, 3 Sep 2013 12:41:46 +0000 (+0100) Subject: libxl: Do not generate short block in libxl__datacopier_prefixdata X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5979 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f6d2a87f051456bddb7a47922c8cf60f37073063;p=xen.git libxl: Do not generate short block in libxl__datacopier_prefixdata libxl__datacopier_prefixdata would prepend a deliberately short block (not just a half-full one, but one with a short buffer) to the dc->bufs queue. However, this is wrong because datacopier_readable will find it and try to continue to fill it up. Instead, allocate a full-sized buffer. Signed-off-by: Ian Jackson Tested-by: Chunyan Liu Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c index 983a60afc7..b4eb6e5284 100644 --- a/tools/libxl/libxl_aoutils.c +++ b/tools/libxl/libxl_aoutils.c @@ -89,7 +89,7 @@ void libxl__datacopier_prefixdata(libxl__egc *egc, libxl__datacopier_state *dc, assert(len < dc->maxsz - dc->used); - buf = libxl__zalloc(NOGC, sizeof(*buf) - sizeof(buf->buf) + len); + buf = libxl__zalloc(NOGC, sizeof(*buf)); buf->used = len; memcpy(buf->buf, data, len);