From 18af127cad1f6751a08924ae84fb9bac6c50433c Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Tue, 23 Jul 2019 11:51:15 +0800 Subject: [PATCH] net/ice/base: fix bitmap and/or routines There was an issue with ice_and_bitmap and ice_or_bitmap when dealing with bit array sizes that are not even multiples of 32, where some of relevant bits in the highest 32 bits were being cleared. This patch fixes those problems. Fixes: c9e37832c95f ("net/ice/base: rework on bit ops") Cc: stable@dpdk.org Signed-off-by: Dan Nowlin Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_bitops.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/base/ice_bitops.h b/drivers/net/ice/base/ice_bitops.h index c74407d9d5..a3a67eb4bf 100644 --- a/drivers/net/ice/base/ice_bitops.h +++ b/drivers/net/ice/base/ice_bitops.h @@ -191,8 +191,7 @@ ice_and_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1, * size value alone. */ mask = LAST_CHUNK_MASK(size); - dst[i] &= ~mask; - dst[i] |= (bmp1[i] & bmp2[i]) & mask; + dst[i] = (dst[i] & ~mask) | ((bmp1[i] & bmp2[i]) & mask); res |= dst[i] & mask; return res != 0; @@ -226,8 +225,7 @@ ice_or_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1, * within the specified size. */ mask = LAST_CHUNK_MASK(size); - dst[i] &= ~mask; - dst[i] |= (bmp1[i] | bmp2[i]) & mask; + dst[i] = (dst[i] & ~mask) | ((bmp1[i] | bmp2[i]) & mask); } /** -- 2.20.1