> -----Original Message-----
> From: Ferruh Yigit <ferruh.yi...@intel.com>
> Sent: Friday, September 11, 2020 7:08 PM
> To: Zhang, Qi Z <qi.z.zh...@intel.com>; Yang, Qiming
> <qiming.y...@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/40] ice base code update
> 
> On 9/10/2020 4:26 AM, Zhang, Qi Z wrote:
> >
> >
> >> -----Original Message-----
> >> From: Yang, Qiming <qiming.y...@intel.com>
> >> Sent: Wednesday, September 9, 2020 3:17 PM
> >> To: Zhang, Qi Z <qi.z.zh...@intel.com>
> >> Cc: dev@dpdk.org
> >> Subject: RE: [PATCH 00/40] ice base code update
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: Zhang, Qi Z <qi.z.zh...@intel.com>
> >>> Sent: Monday, September 7, 2020 19:28
> >>> To: Yang, Qiming <qiming.y...@intel.com>
> >>> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zh...@intel.com>
> >>> Subject: [PATCH 00/40] ice base code update
> >>>
> >>> main changes:
> >>> 1. Added support for outer IP filter for GTPC.
> >>> 2. Added support for outer IP filter for GPTU control packet (no inner 
> >>> IP) 3.
> >>> Added support for QinQ switch filter 4. code refactor and bug fixes
> >>>
> >>> Qi Zhang (40):
> >>>   net/ice/base: handle error gracefully in HW table calloc
> >>>   net/ice/base: split caps discover into two functions
> >>>   net/ice/base: avoid unnecessary single-member variable-length structs
> >>>   net/ice/base: fix issues around move nodes
> >>>   net/ice/base: cleanup stack hog
> >>>   net/ice/base: clean the code wrapping
> >>>   net/ice/base: cleanup misleading comment
> >>>   net/ice/base: silence static analysis warning
> >>>   net/ice/base: replace single-element array used for C struct hack
> >>>   net/ice/base: introduce and use bitmap set API
> >>>   net/ice/base: introduce and use bitmap hamming weight API
> >>>   net/ice/base: add function header
> >>>   net/ice/base: introduce and use for each bit iterator
> >>>   net/ice/base: correct abbreviations
> >>>   net/ice/base: add AQ cmd 0X0A0A LLDP fltr control
> >>>   net/ice/base: add support for GTP-U type switch rule
> >>>   net/ice/base: join format strings to same line
> >>>   net/ice/base: introduce Tx rate limiting on port level
> >>>   net/ice/base: reduce profile to recip info get from firmware
> >>>   net/ice/base: refactor DCB related variables
> >>>   net/ice/base: support outer IP filter for GTPC
> >>>   net/ice/base: support outer IP filter for GTPU without inner IP
> >>>   net/ice/base: move a function
> >>>   net/ice/base: clear advanced rules in reset preparation
> >>>   net/ice/base: move a function
> >>>   net/ice/base: add check for failed acts allocation
> >>>   net/ice/base: remove repeated words
> >>>   net/ice/base: remove function ACL count query
> >>>   net/ice/base: preserve NVM capabilities in safe mode
> >>>   net/ice/base: misc minor ACL changes
> >>>   net/ice/base: adjust rate limit profile ids runtime database
> >>>   net/ice/base: enable QinQ filter for switch advanced rule
> >>>   net/ice/base: create flash info structure and separate NVM version
> >>>   net/ice/base: remove unused parameter
> >>>   net/ice/base: minor code clean
> >>>   net/ice/base: cache NVM module bank information
> >>>   net/ice/base: rename function
> >>>   net/ice/base: remove unnecessary conditional
> >>>   net/ice/base: rename ACL priority values
> >>>   net/ice/base: preserve default aggr vsi information
> >>>
> 
> 
> Hi Qi,
> 
> I am getting build error [1], can you please check.
> 
> 
> [1]
> ../drivers/net/ice/ice_rxtx.c: In function ‘ice_tx_queue_start’:
> ../drivers/net/ice/ice_rxtx.c:486:15: error: array subscript 0 is outside 
> array
> bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
>   486 |  txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx);
>       |  ~~~~~~~~~~~~~^~~
> In file included from ../drivers/net/ice/base/ice_controlq.h:8,
>                  from ../drivers/net/ice/base/ice_type.h:52,
>                  from ../drivers/net/ice/base/ice_common.h:8,
>                  from ../drivers/net/ice/ice_ethdev.h:12,
>                  from ../drivers/net/ice/ice_rxtx.h:8,
>                  from ../drivers/net/ice/ice_rxtx.c:9:
> ../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing
> ‘txqs’
>  2429 |  struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
>       |                               ^~~~
> ../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
>   462 |  struct ice_aqc_add_tx_qgrp txq_elem;
>       |                             ^~~~~~~~
> ../drivers/net/ice/ice_rxtx.c:498:54: error: array subscript 0 is outside 
> array
> bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
>   498 |  ice_set_ctx(hw, (uint8_t *)&tx_ctx, txq_elem.txqs[0].txq_ctx,
>       |
> ~~~~~~~~~~~~~~~~^~~~~~~~
> In file included from ../drivers/net/ice/base/ice_controlq.h:8,
>                  from ../drivers/net/ice/base/ice_type.h:52,
>                  from ../drivers/net/ice/base/ice_common.h:8,
>                  from ../drivers/net/ice/ice_ethdev.h:12,
>                  from ../drivers/net/ice/ice_rxtx.h:8,
>                  from ../drivers/net/ice/ice_rxtx.c:9:
> ../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing
> ‘txqs’
>  2429 |  struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
>       |                               ^~~~
> ../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
>   462 |  struct ice_aqc_add_tx_qgrp txq_elem;
>       |                             ^~~~~~~~
> ../drivers/net/ice/ice_rxtx.c:514:29: error: array subscript 0 is outside 
> array
> bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
>   514 |  txq->q_teid = txq_elem.txqs[0].q_teid;
>       |                ~~~~~~~~~~~~~^~~
> In file included from ../drivers/net/ice/base/ice_controlq.h:8,
>                  from ../drivers/net/ice/base/ice_type.h:52,
>                  from ../drivers/net/ice/base/ice_common.h:8,
>                  from ../drivers/net/ice/ice_ethdev.h:12,
>                  from ../drivers/net/ice/ice_rxtx.h:8,
>                  from ../drivers/net/ice/ice_rxtx.c:9:
> ../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing
> ‘txqs’
>  2429 |  struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
>       |                               ^~~~
> ../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
>   462 |  struct ice_aqc_add_tx_qgrp txq_elem;
>       |                             ^~~~~~~~
> ../drivers/net/ice/ice_rxtx.c: In function ‘ice_fdir_tx_queue_start’:
> ../drivers/net/ice/ice_rxtx.c:658:15: error: array subscript 0 is outside 
> array
> bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
>   658 |  txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx);
>       |  ~~~~~~~~~~~~~^~~
> In file included from ../drivers/net/ice/base/ice_controlq.h:8,
>                  from ../drivers/net/ice/base/ice_type.h:52,
>                  from ../drivers/net/ice/base/ice_common.h:8,
>                  from ../drivers/net/ice/ice_ethdev.h:12,
>                  from ../drivers/net/ice/ice_rxtx.h:8,
>                  from ../drivers/net/ice/ice_rxtx.c:9:
> ../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing
> ‘txqs’
>  2429 |  struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
>       |                               ^~~~
> ../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
>   640 |  struct ice_aqc_add_tx_qgrp txq_elem;
>       |                             ^~~~~~~~
> ../drivers/net/ice/ice_rxtx.c:670:54: error: array subscript 0 is outside 
> array
> bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
>   670 |  ice_set_ctx(hw, (uint8_t *)&tx_ctx, txq_elem.txqs[0].txq_ctx,
>       |
> ~~~~~~~~~~~~~~~~^~~~~~~~
> In file included from ../drivers/net/ice/base/ice_controlq.h:8,
>                  from ../drivers/net/ice/base/ice_type.h:52,
>                  from ../drivers/net/ice/base/ice_common.h:8,
>                  from ../drivers/net/ice/ice_ethdev.h:12,
>                  from ../drivers/net/ice/ice_rxtx.h:8,
>                  from ../drivers/net/ice/ice_rxtx.c:9:
> ../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing
> ‘txqs’
>  2429 |  struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
>       |                               ^~~~
> ../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
>   640 |  struct ice_aqc_add_tx_qgrp txq_elem;
>       |                             ^~~~~~~~
> ../drivers/net/ice/ice_rxtx.c:686:29: error: array subscript 0 is outside 
> array
> bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
>   686 |  txq->q_teid = txq_elem.txqs[0].q_teid;
>       |                ~~~~~~~~~~~~~^~~
> In file included from ../drivers/net/ice/base/ice_controlq.h:8,
>                  from ../drivers/net/ice/base/ice_type.h:52,
>                  from ../drivers/net/ice/base/ice_common.h:8,
>                  from ../drivers/net/ice/ice_ethdev.h:12,
>                  from ../drivers/net/ice/ice_rxtx.h:8,
>                  from ../drivers/net/ice/ice_rxtx.c:9:
> ../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing
> ‘txqs’
>  2429 |  struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
>       |                               ^~~~
> ../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
>   640 |  struct ice_aqc_add_tx_qgrp txq_elem;
>       |                             ^~~~~~~~
> cc1: all warnings being treated as errors

Seems this issue is only reported by a new version GCC, and it does help to 
detect a invalid memory access issue.
The bug has been fixed in dpdk-next-net-intel on below commit

commit 978dddfae32764dd6ba81d615399fbc0452ecfb3
Author: Qi Zhang <qi.z.zh...@intel.com>
Date:   Wed Aug 26 14:57:07 2020 +0800

    net/ice/base: replace single-element array used for C struct hack

    Convert the pre-C90-extension "C struct hack" method (using a single-
    element array at the end of a structure for implementing variable-length
    types) to the preferred use of C99 flexible array member.

Thanks
Qi

Reply via email to