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

Message ID 1424448824-6224-1-git-send-email-maciejx.t.gajdzica@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Maciej Gajdzica Feb. 20, 2015, 4:13 p.m. UTC
  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@intel.com>
---
 lib/librte_pmd_enic/vnic/vnic_dev.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

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