From: Marek Marczykowski-Górecki Date: Mon, 13 May 2019 08:12:00 +0000 (+0200) Subject: bitmap: fix bitmap_fill with zero-sized bitmap X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2304 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=93df28be2d4f620caf18109222d046355ac56327;p=xen.git bitmap: fix bitmap_fill with zero-sized bitmap When bitmap_fill(..., 0) is called, do not try to write anything. Before this patch, it tried to write almost LONG_MAX, surely overwriting something. Signed-off-by: Marek Marczykowski-Górecki Reviewed-by: Andrew Cooper Reviewed-by: Jan Beulich --- diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h index fe3c720e82..0430c1ce2a 100644 --- a/xen/include/xen/bitmap.h +++ b/xen/include/xen/bitmap.h @@ -126,6 +126,8 @@ static inline void bitmap_fill(unsigned long *dst, int nbits) size_t nlongs = BITS_TO_LONGS(nbits); switch (nlongs) { + case 0: + break; default: memset(dst, -1, (nlongs - 1) * sizeof(unsigned long)); /* fall through */