[dpdk-dev,04/10] net/i40e: fix compilation with -Og
Checks
Commit Message
The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the following
error:
CC i40e_adminq.o
i40e_adminq.c: In function ‘i40e_clean_arq_element’:
i40e_adminq.c:1145:56: error: ‘ntu’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
~~~~~^~~~~~
Depending on what is defined, ntu actually be used without being
initialized. Fix it by initializing it to 0, despite this is probably
not the proper fix. Moreover, the error is located in base/ directory,
which contains driver code common to several platforms (not only dpdk).
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
drivers/net/i40e/base/i40e_adminq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 9/11/2017 4:13 PM, Olivier Matz wrote:
> The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the following
> error:
>
> CC i40e_adminq.o
> i40e_adminq.c: In function ‘i40e_clean_arq_element’:
> i40e_adminq.c:1145:56: error: ‘ntu’ may be used uninitialized in
> this function [-Werror=maybe-uninitialized]
> *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
> ~~~~~^~~~~~
>
> Depending on what is defined, ntu actually be used without being
> initialized. Fix it by initializing it to 0, despite this is probably
> not the proper fix. Moreover, the error is located in base/ directory,
> which contains driver code common to several platforms (not only dpdk).
This practically seems false positive because driver makefile hard-coded
both defines.
Also ntu used before this location, not sure warning generated for here.
Overall I am for fixing the compile warning, but for decision maintainer
cc'ed because this being base code update requires maintainer
communicate other channels to reflect update into base code.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> drivers/net/i40e/base/i40e_adminq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
> index 8cc8c5eca..27c133323 100644
> --- a/drivers/net/i40e/base/i40e_adminq.c
> +++ b/drivers/net/i40e/base/i40e_adminq.c
> @@ -1047,7 +1047,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
> u16 desc_idx;
> u16 datalen;
> u16 flags;
> - u16 ntu;
> + u16 ntu = 0;
>
> /* pre-clean the event info */
> i40e_memset(&e->desc, 0, sizeof(e->desc), I40E_NONDMA_MEM);
>
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, October 6, 2017 7:25 AM
> To: Olivier Matz <olivier.matz@6wind.com>; dev@dpdk.org; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Subject: Re: [dpdk-dev] [PATCH 04/10] net/i40e: fix compilation with -Og
>
> On 9/11/2017 4:13 PM, Olivier Matz wrote:
> > The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the
> > following
> > error:
> >
> > CC i40e_adminq.o
> > i40e_adminq.c: In function ‘i40e_clean_arq_element’:
> > i40e_adminq.c:1145:56: error: ‘ntu’ may be used uninitialized in
> > this function [-Werror=maybe-uninitialized]
> > *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
> > ~~~~~^~~~~~
> >
> > Depending on what is defined, ntu actually be used without being
> > initialized. Fix it by initializing it to 0, despite this is probably
> > not the proper fix. Moreover, the error is located in base/ directory,
> > which contains driver code common to several platforms (not only dpdk).
>
> This practically seems false positive because driver makefile hard-coded both
> defines.
>
> Also ntu used before this location, not sure warning generated for here.
>
> Overall I am for fixing the compile warning, but for decision maintainer cc'ed
> because this being base code update requires maintainer communicate other
> channels to reflect update into base code.
>
Right, for base code, we are getting them from internal release.
In principle, based code would keep unchanged until the base code update.
I will go to report this issue to base code develop team, and then make
It be fixed in next base code drop. Is that OK?
Thanks
Jingjing
On Wed, Oct 11, 2017 at 06:20:35AM +0000, Wu, Jingjing wrote:
>
>
> > -----Original Message-----
> > From: Yigit, Ferruh
> > Sent: Friday, October 6, 2017 7:25 AM
> > To: Olivier Matz <olivier.matz@6wind.com>; dev@dpdk.org; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH 04/10] net/i40e: fix compilation with -Og
> >
> > On 9/11/2017 4:13 PM, Olivier Matz wrote:
> > > The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the
> > > following
> > > error:
> > >
> > > CC i40e_adminq.o
> > > i40e_adminq.c: In function ‘i40e_clean_arq_element’:
> > > i40e_adminq.c:1145:56: error: ‘ntu’ may be used uninitialized in
> > > this function [-Werror=maybe-uninitialized]
> > > *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
> > > ~~~~~^~~~~~
> > >
> > > Depending on what is defined, ntu actually be used without being
> > > initialized. Fix it by initializing it to 0, despite this is probably
> > > not the proper fix. Moreover, the error is located in base/ directory,
> > > which contains driver code common to several platforms (not only dpdk).
> >
> > This practically seems false positive because driver makefile hard-coded both
> > defines.
> >
> > Also ntu used before this location, not sure warning generated for here.
> >
> > Overall I am for fixing the compile warning, but for decision maintainer cc'ed
> > because this being base code update requires maintainer communicate other
> > channels to reflect update into base code.
> >
> Right, for base code, we are getting them from internal release.
> In principle, based code would keep unchanged until the base code update.
>
> I will go to report this issue to base code develop team, and then make
> It be fixed in next base code drop. Is that OK?
Fine to me, thanks.
@@ -1047,7 +1047,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
u16 desc_idx;
u16 datalen;
u16 flags;
- u16 ntu;
+ u16 ntu = 0;
/* pre-clean the event info */
i40e_memset(&e->desc, 0, sizeof(e->desc), I40E_NONDMA_MEM);