[dpdk-dev] [PATCH] examples/ethtool: include case for 64-bit registers

zr at semihalf.com zr at semihalf.com
Wed May 11 12:48:34 CEST 2016


From: Zyta Szpak <zyta.szpak at semihalf.com>

rte_eth_dev_get_reg_length and rte_eth_dev_get_reg callbacks
do not provide register size to the app in any way. Example assuming
they are 32-bit wide always allocates not enough memory if the
registers are 64-bit wide. It results in memory corruption.
This commit is a quick fix to make enough room for 64-bit
register values when this returned value is given to malloc.

Signed-off-by: Zyta Szpak <zr at semihalf.com>
---
 examples/ethtool/lib/rte_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 42e05f1..bf0a6ac 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -91,7 +91,7 @@ rte_ethtool_get_regs_len(uint8_t port_id)
 
 	count_regs = rte_eth_dev_get_reg_length(port_id);
 	if (count_regs > 0)
-		return count_regs * sizeof(uint32_t);
+		return count_regs * sizeof(uint64_t);
 	return count_regs;
 }
 
-- 
1.9.1



More information about the dev mailing list