left shift of negative value in dcbp_set_pad_bits()
This fixes a C undefined-behavior runtime error encountered by libubsan after gcc -fsanitize=undefined:
left shift of negative value in dcbp_set_pad_bits()
I mentioned this one before, but in the context of a boring compiler warning. The runtime undefined-behavior may make it more interesting.
drbd/drbd_main.c +0 -0
@@ -1832,7 +1840,7 @@ static void dcbp_set_start(struct p_compressed_bm *p, int set)static void dcbp_set_pad_bits (struct p_compressed_bm *p,int n) {
BUG_ON(n & ~0x7);
- p->encoding = (p->encoding & (~0x7 << 4)) | (n << 4);
+ p->encoding = (p->encoding & (~0x7u << 4)) | (n << 4);
}
static int fill_bitmap_rle_bits(struct drbd_peer_device *peer_device,