DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/ethtool: include case for 64-bit registers
@ 2016-05-11 10:48 zr
  2016-05-20  8:25 ` Remy Horton
  2016-05-25  6:36 ` [dpdk-dev] [PATCH 1/2] ethdev: add callback to get register size in bytes zr
  0 siblings, 2 replies; 11+ messages in thread
From: zr @ 2016-05-11 10:48 UTC (permalink / raw)
  To: remy.horton; +Cc: dev, Zyta Szpak, Zyta Szpak

From: Zyta Szpak <zyta.szpak@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@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-05-30  9:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 10:48 [dpdk-dev] [PATCH] examples/ethtool: include case for 64-bit registers zr
2016-05-20  8:25 ` Remy Horton
2016-05-23  5:11   ` Zyta Szpak
2016-05-25  6:36 ` [dpdk-dev] [PATCH 1/2] ethdev: add callback to get register size in bytes zr
2016-05-25  6:36   ` [dpdk-dev] [PATCH 2/2] examples/ethtool: get reg width to allocate memory zr
2016-05-25 13:14     ` Remy Horton
2016-05-25 13:14   ` [dpdk-dev] [PATCH 1/2] ethdev: add callback to get register size in bytes Remy Horton
2016-05-30  9:00     ` Zyta Szpak
2016-05-27 10:28   ` Panu Matilainen
2016-05-27 14:43     ` Thomas Monjalon
2016-05-30  9:32     ` Zyta Szpak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).