]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
bitmap: fix bitmap_fill with zero-sized bitmap
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tue, 4 Jun 2019 13:35:35 +0000 (15:35 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 4 Jun 2019 13:35:35 +0000 (15:35 +0200)
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 <marmarek@invisiblethingslab.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 93df28be2d4f620caf18109222d046355ac56327
master date: 2019-05-13 10:12:00 +0200

xen/include/xen/bitmap.h

index fe3c720e8253f6b43d5a9d08c6d21cab8d6af022..0430c1ce2af4c0e1a6542ead75e399fc0b9c6abb 100644 (file)
@@ -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 */