DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Conor Walsh <conor.walsh@intel.com>,
	jiawenwu@trustnetic.com, jianwang@trustnetic.com
Cc: dev@dpdk.org, linglix.chen@intel.com
Subject: Re: [dpdk-dev] [PATCH v1] net/txgbe: offset needs to be initialised to fix gcc compile error
Date: Wed, 11 Nov 2020 13:14:18 +0000	[thread overview]
Message-ID: <455bfd94-bc18-b2c9-947d-c1b9489985f3@intel.com> (raw)
In-Reply-To: <20201111130542.1949894-1-conor.walsh@intel.com>

On 11/11/2020 1:05 PM, Conor Walsh wrote:
> When DPDK is compiled with gcc 7.5 with the optimization level set to 1
> gcc sees the offset variable in txgbe_ethdev.c as possibly being
> uninitialised. To correct this error offset has been initialised to 0 in
> txgbe_ethdev.c
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> ---
>   drivers/net/txgbe/txgbe_ethdev.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
> index 9f533603a1..7fd56c2698 100644
> --- a/drivers/net/txgbe/txgbe_ethdev.c
> +++ b/drivers/net/txgbe/txgbe_ethdev.c
> @@ -2247,7 +2247,7 @@ txgbe_dev_xstats_get_(struct rte_eth_dev *dev, uint64_t *values,
>   
>   	/* Extended stats from txgbe_hw_stats */
>   	for (i = 0; i < limit; i++) {
> -		uint32_t offset;
> +		uint32_t offset = 0;
>   

This is false positive, right?
Is there an actual case that 'offset' is used without initialization?

'txgbe_get_offset_by_id()' return value seems used only to detect fail/success,
can you please try with 'txgbe_get_offset_by_id()' returning a simple '-1' on 
failure, instead of current "-(int)(id + 1)", if it helps with the compiler warning?

  reply	other threads:[~2020-11-11 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 13:05 Conor Walsh
2020-11-11 13:14 ` Ferruh Yigit [this message]
2020-11-11 15:39 ` [dpdk-dev] [PATCH v2] net/txgbe: return changed " Conor Walsh
2020-11-12 15:05   ` Ferruh Yigit

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=455bfd94-bc18-b2c9-947d-c1b9489985f3@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=linglix.chen@intel.com \
    /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).