From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=j68CQZic9LxXFSYrqus06+eFadJU9vleV3qwzBtLaa8=; b=QfZmijkiLladND+Bsl72b2D0TQT7TelalFCatP0qZjDgkILqKx2vEDuiRmfn0sX4NQ I++VizTF66qzK+AvohKfeem80cVC+nqZQ6YRuF3R+dQyZ1NN5vWVI8SEDvLj4qjihRgT YiZq0JOsglpwMC4C8s7aRnimZuvNd+3GRu0MChyyCADpjrCllH6FXmL/Y9Qk/jGkX91o vqiw9yhvkOoUshpuo98lBcM4/WPYvnZY3eElDFS5C66SozFyoxfMqz3hv3A+mdCr++Za S87AEUn3+eq2Lm2N5hecSODW/69hkPzHZC+W7ZLyESdgSUA2zlQBwBsBaq/lla9Hm05d gSMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=j68CQZic9LxXFSYrqus06+eFadJU9vleV3qwzBtLaa8=; b=G9G/dfMbNuF9BMfI9OZ7Y6U7mIuLb5EQGwzdxeJ0D8fvEtRoTdoyrAhkfjRtr4EHDG aSdFh2JaB7t/osBWQ5R7QtuMQKpvmopT79tG3dYubxgeuIdV4aPH5Jr6rHUeQ+68xMc7 qjKD0DLwQxdMTicVygFjmzd1p/4+dhRoz4jfrf3lyJXs2Xu7gZTVi4H2O6F+4D2lx+Gj kzkerXxCVobidyzZ7jxCPMGq7c2qeDvTNSXPFyP1OsHh6+Y+u4u0E/8scEy+xLVvgnWg B8UMJoPv7/EIhJKLvIva1sKgSrFDWF9JcIiAuVKVjnHT8p+r6iXZ2XbxFf6+/BNySaZh cwgw== X-Gm-Message-State: AOPr4FV15XQPpREV93jBp0Pnrud1yWiJIaDo1B6DZqQn5EpwY/2oevHv/VPeTI3zol1TuA== X-Received: by 10.25.136.137 with SMTP id k131mr1182625lfd.88.1462963716417; Wed, 11 May 2016 03:48:36 -0700 (PDT) Received: from zr-HP-Pro-3500-Series.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id i6sm1202745lbc.8.2016.05.11.03.48.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 03:48:35 -0700 (PDT) From: zr@semihalf.com To: remy.horton@intel.com Cc: dev@dpdk.org, Zyta Szpak , Zyta Szpak Date: Wed, 11 May 2016 12:48:34 +0200 Message-Id: <1462963714-21022-1-git-send-email-zr@semihalf.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] examples/ethtool: include case for 64-bit registers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2016 10:48:37 -0000 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