[dpdk-dev] [PATCH] enic: fixed possible data loss in vnic_dev.h

Maciej Gajdzica maciejx.t.gajdzica at intel.com
Fri Feb 20 17:13:44 CET 2015


In function writeq is written in two 32-bit long registers with writel
function. When trying to write val >> 32, static code analysis tool
reports that 64-bit value is passed to function expecting 32-bit value.
Added cast to clear this warning.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica at intel.com>
---
 lib/librte_pmd_enic/vnic/vnic_dev.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.h b/lib/librte_pmd_enic/vnic/vnic_dev.h
index d1373a5..ca1174f 100644
--- a/lib/librte_pmd_enic/vnic/vnic_dev.h
+++ b/lib/librte_pmd_enic/vnic/vnic_dev.h
@@ -55,7 +55,7 @@ static inline u64 readq(void __iomem *reg)
 static inline void writeq(u64 val, void __iomem *reg)
 {
 	writel(val & 0xffffffff, reg);
-	writel(val >> 32, (char *)reg + 0x4UL);
+	writel((u32)(val >> 32), (char *)reg + 0x4UL);
 }
 #endif
 
-- 
1.7.9.5



More information about the dev mailing list