DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrzej Ostruszka <amo@semihalf.com>
To: Hemant Agrawal <hemant.agrawal@nxp.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Sachin Saxena <sachin.saxena@nxp.com>
Cc: "mattias.ronnblom@ericsson.com" <mattias.ronnblom@ericsson.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>,
	Andrzej Ostruszka <aostruszka@marvell.com>
Subject: Re: [dpdk-dev] [PATCH 06/10] net/dpaa2: fix possible use of uninitialized vars
Date: Thu, 5 Sep 2019 18:04:59 +0200	[thread overview]
Message-ID: <d953e020-385d-3e4d-82e2-17fc7d1e0b7f@semihalf.com> (raw)
In-Reply-To: <VI1PR0401MB25419AE95E8E6BCE90FE8F0C89BB0@VI1PR0401MB2541.eurprd04.prod.outlook.com>

On 9/5/19 4:10 PM, Hemant Agrawal wrote:
> Hi Andrzei,
> 
>> -----Original Message-----
> 
>> diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c
>> index 362cd476f..b74a1a317 100644
>> --- a/drivers/net/dpaa2/mc/dpni.c
>> +++ b/drivers/net/dpaa2/mc/dpni.c
>> @@ -1803,10 +1803,13 @@ int dpni_set_congestion_notification(struct
>> fsl_mc_io *mc_io,
>>  	cmd_params->qtype = qtype;
>>  	cmd_params->tc = tc_id;
>>  	cmd_params->congestion_point = cfg->cg_point;
>> -	cmd_params->cgid = (uint8_t)cfg->cgid;
>> -	cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
>> +	if (cfg->cg_point == DPNI_CP_CONGESTION_GROUP)
>> +		cmd_params->cgid = (uint8_t)cfg->cgid;
>> +	if (cfg->dest_cfg.dest_type != DPNI_DEST_NONE) {
>> +		cmd_params->dest_id = cpu_to_le32(cfg-
>>> dest_cfg.dest_id);
>> +		cmd_params->dest_priority = cfg->dest_cfg.priority;
>> +	}
> 
> [Hemant] what was the exact issues you are facing in this piece of code? 
> Please share your compiler and other env details. 
> 
>>  	cmd_params->notification_mode = cpu_to_le16(cfg-
>>> notification_mode);
>> -	cmd_params->dest_priority = cfg->dest_cfg.priority;

That was warning from compiler that neither of these:
- cfg->cgid
- cfg->dest_cfg.dest_id
- cfg->dest_cfg.dest_priority
is initialized in dpaa2_dev_tx_queue_setup() where this function is
called and they are used here.  This might be non issue - I've changed
the function here however since I though it would be better - but I
don't know this code, I'm just guessing that:
- cgid is meaningful only when cg_point is DPNI_CP_CONGESTION_GROUP
- dest_id/dest_priority are meaningful when dest_type is not DPNI_DEST_NONE.

That was developed on 19.05 and rebased to 19.11 and I was using gcc
(7.4) however today when I commented out those 'if' I did not got the
warning which I wanted to send here.  I'll try to figure out what has
changed that this is no longer reported (I think the compiler should
still report this).

Best regards
Andrzej

BTW.  In my original submission I've made a mistake with DPDK dev
e-mail, so I'm replying now with it corrected.

       reply	other threads:[~2019-09-05 16:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190905092001.26011-1-amo@semihalf.com>
     [not found] ` <20190905092001.26011-7-amo@semihalf.com>
     [not found]   ` <VI1PR0401MB25419AE95E8E6BCE90FE8F0C89BB0@VI1PR0401MB2541.eurprd04.prod.outlook.com>
2019-09-05 16:04     ` Andrzej Ostruszka [this message]
2019-09-05  9:32 [dpdk-dev] [PATCH 00/10] Add an option to use LTO for DPDK build Andrzej Ostruszka
2019-09-05  9:32 ` [dpdk-dev] [PATCH 06/10] net/dpaa2: fix possible use of uninitialized vars Andrzej Ostruszka

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=d953e020-385d-3e4d-82e2-17fc7d1e0b7f@semihalf.com \
    --to=amo@semihalf.com \
    --cc=aostruszka@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=sachin.saxena@nxp.com \
    --cc=stephen@networkplumber.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).