From mboxrd@z Thu Jan 1 00:00:00 1970 From: zr@semihalf.com Subject: [PATCH] examples/ethtool: include case for 64-bit registers Date: Wed, 11 May 2016 12:48:34 +0200 Message-ID: <1462963714-21022-1-git-send-email-zr@semihalf.com> Cc: dev@dpdk.org, Zyta Szpak , Zyta Szpak To: remy.horton@intel.com Return-path: Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by dpdk.org (Postfix) with ESMTP id C4022C43A for ; Wed, 11 May 2016 12:48:36 +0200 (CEST) Received: by mail-lf0-f51.google.com with SMTP id u64so45027848lff.3 for ; Wed, 11 May 2016 03:48:36 -0700 (PDT) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Zyta Szpak 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 --- 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