Shifting by equal to or bigger than the width of a type results in undefined behavior. By using a wide enough temporary variable the issue can be avoided. Signed-off-by: Guillermo O. Freschi <kedrot@xxxxxxxxx> --- drivers/staging/wilc1000/host_interface.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f7c22d7b28d1..ed614698c22c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2416,10 +2416,12 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, goto ERRORHANDLER; pu8CurrByte = wid.val; - *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); + + u32 enabled = strHostIfSetMulti->enabled; + *pu8CurrByte++ = (enabled & 0xFF); + *pu8CurrByte++ = ((enabled >> 8) & 0xFF); + *pu8CurrByte++ = ((enabled >> 16) & 0xFF); + *pu8CurrByte++ = ((enabled >> 24) & 0xFF); *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); -- 2.11.0