From: Rasesh Mody Date: Thu, 5 Jan 2017 07:03:44 +0000 (-0800) Subject: net/qede/base: improve set field macro X-Git-Tag: spdx-start~4900 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=830aba26d9bb920fff4ead9305a56d3951bcd937;p=dpdk.git net/qede/base: improve set field macro Improve robustness of the SET_FIELD macro by using a mask. Signed-off-by: Rasesh Mody --- diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 907b35b972..c9f3b003e8 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -80,7 +80,7 @@ enum ecore_nvm_cmd { #define SET_FIELD(value, name, flag) \ do { \ (value) &= ~(name##_MASK << name##_SHIFT); \ - (value) |= (((u64)flag) << (name##_SHIFT)); \ + (value) |= ((((u64)flag) & (u64)name##_MASK) << (name##_SHIFT));\ } while (0) #define GET_FIELD(value, name) \