From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 169E21B16C for ; Mon, 16 Apr 2018 12:55:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2018 03:55:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,459,1517904000"; d="scan'208";a="42279627" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by FMSMGA003.fm.intel.com with ESMTP; 16 Apr 2018 03:55:23 -0700 From: Fan Zhang To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com Date: Mon, 16 Apr 2018 11:47:51 +0100 Message-Id: <20180416104751.65646-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: fix uninitialized scalar variable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 10:55:26 -0000 Coverity issue: 272575 Fixes: 133c2c6565d6 ("examples/ip_pipeline: add link object") Signed-off-by: Fan Zhang --- examples/ip_pipeline/cli.c | 2 +- examples/ip_pipeline/link.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 199a31ff8..ec43a2308 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -133,7 +133,7 @@ cmd_link(char **tokens, char *out, size_t out_size) { - struct link_params p; + struct link_params p = {0}; struct link_params_rss rss; struct link *link; char *name; diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c index 26ff41ba9..25717808c 100644 --- a/examples/ip_pipeline/link.c +++ b/examples/ip_pipeline/link.c @@ -121,17 +121,19 @@ link_create(const char *name, struct link_params *params) (params->tx.queue_size == 0)) return NULL; - port_id = params->port_id; if (params->dev_name) { status = rte_eth_dev_get_port_by_name(params->dev_name, &port_id); if (status) return NULL; - } else - if (!rte_eth_dev_is_valid_port(port_id)) + } else { + if (!rte_eth_dev_is_valid_port(params->port_id)) return NULL; + port_id = params->port_id; + } + rte_eth_dev_info_get(port_id, &port_info); mempool = mempool_find(params->rx.mempool_name); -- 2.13.6