From 830aba26d9bb920fff4ead9305a56d3951bcd937 Mon Sep 17 00:00:00 2001 From: Rasesh Mody Date: Wed, 4 Jan 2017 23:03:44 -0800 Subject: [PATCH] net/qede/base: improve set field macro Improve robustness of the SET_FIELD macro by using a mask. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) \ -- 2.20.1