From: Marek Marczykowski-Górecki Date: Thu, 6 Jun 2019 12:08:10 +0000 (+0200) Subject: bitmap: fix bitmap_fill with zero-sized bitmap X-Git-Tag: RELEASE-4.11.2~32 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ba75e0d44b58c53696c09eaea7fc53c923c3ccc5;p=people%2Fdwmw2%2Fxen.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 master commit: 93df28be2d4f620caf18109222d046355ac56327 master date: 2019-05-13 10:12:00 +0200 --- diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h index e2a368691e..ab3b113fd1 100644 --- a/xen/include/xen/bitmap.h +++ b/xen/include/xen/bitmap.h @@ -132,6 +132,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 */