DPDK patches and discussions
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v1 1/2] examples/ethtool: Fix uninitialised variable
Date: Thu, 10 Dec 2015 09:50:06 +0000	[thread overview]
Message-ID: <1449741007-1022-2-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1449741007-1022-1-git-send-email-remy.horton@intel.com>

Fix Coverity warning with uninitialised field in structure being used.
Zero out all the other unused ones.

>>> CID 120413 (#1 of 1): Uninitialized scalar variable (UNINIT)

Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 examples/ethtool/ethtool-app/ethapp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 3863b02..2ed4796 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -339,6 +339,7 @@ pcmd_pause_callback(void *ptr_params,
 	if (ptr_data != NULL) {
 		stat = rte_ethtool_get_pauseparam(params->port, &info);
 	} else {
+		memset(&info, 0, sizeof(info));
 		if (strcasecmp("all", params->opt) == 0) {
 			info.tx_pause = 1;
 			info.rx_pause = 1;
@@ -352,6 +353,8 @@ pcmd_pause_callback(void *ptr_params,
 			info.tx_pause = 0;
 			info.rx_pause = 0;
 		}
+		/* Assume auto-negotiation wanted */
+		info.autoneg = 1;
 		stat = rte_ethtool_set_pauseparam(params->port, &info);
 	}
 	if (stat == 0) {
-- 
1.9.3

  reply	other threads:[~2015-12-10  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  9:50 [dpdk-dev] [PATCH v1 0/2] Fix various Coverity warnings Remy Horton
2015-12-10  9:50 ` Remy Horton [this message]
2015-12-10 10:20   ` [dpdk-dev] [PATCH v1 1/2] examples/ethtool: Fix uninitialised variable Mcnamara, John
2015-12-10  9:50 ` [dpdk-dev] [PATCH v1 2/2] examples/l2fwd-keepalive: Fix integer overflow Remy Horton
2015-12-10 10:20   ` Mcnamara, John
2015-12-10 21:27 ` [dpdk-dev] [PATCH v1 0/2] Fix various Coverity warnings Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449741007-1022-2-git-send-email-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).