[PATCH v4 10/10] common/dpaxx: remove zero length array

Stephen Hemminger stephen at networkplumber.org
Tue Nov 21 18:01:41 CET 2023


On Tue, 21 Nov 2023 08:46:41 -0800
Stephen Hemminger <stephen at networkplumber.org> wrote:

> On Tue, 21 Nov 2023 10:49:59 +0000
> Hemant Agrawal <hemant.agrawal at nxp.com> wrote:
> 
> > >  struct ipsec_encap_pdb {
> > >  	uint32_t options;
> > > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb {
> > >  	};
> > >  	uint32_t spi;
> > >  	uint32_t ip_hdr_len;
> > > -	uint8_t ip_hdr[0];    
> > [Hemant] This should be replaced with 
> > 	uint8_t ip_hdr[];  
> > >  };
> > >   
> 
> That won't work because the structure is embedded in
> another struct and then clang will correctly report an error.

[2155/2868] Compiling C object drivers..._jr.a.p/crypto_caam_jr_caam_jr_uio.c.o
In file included from ../drivers/crypto/caam_jr/caam_jr_uio.c:23:
../drivers/crypto/caam_jr/caam_jr_pvt.h:139:25: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct ipsec_encap_pdb encap_pdb;
                               ^
1 warning generated.
[2160/2868] Compiling C object drivers...m_jr.a.p/crypto_caam_jr_caam_jr_hw.c.o
In file included from ../drivers/crypto/caam_jr/caam_jr_hw.c:16:
../drivers/crypto/caam_jr/caam_jr_pvt.h:139:25: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct ipsec_encap_pdb encap_pdb;
                               ^
1 warning generated.
[2174/2868] Compiling C object drivers....p/crypto_dpaa_sec_dpaa_sec_raw_dp.c.o
In file included from ../drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c:17:
../drivers/crypto/dpaa_sec/dpaa_sec.h:190:27: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
                        struct ipsec_encap_pdb encap_pdb;
                                               ^
1 warning generated.
[2176/2868] Compiling C object drivers...caam_jr.a.p/crypto_caam_jr_caam_jr.c.o
In file included from ../drivers/crypto/caam_jr/caam_jr.c:23:
../drivers/crypto/caam_jr/caam_jr_pvt.h:139:25: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct ipsec_encap_pdb encap_pdb;
                               ^
1 warning generated.
[2246/2868] Compiling C object drivers...a_sec.a.p/crypto_dpaa_sec_dpaa_sec.c.o
In file included from ../drivers/crypto/dpaa_sec/dpaa_sec.c:43:
../drivers/crypto/dpaa_sec/dpaa_sec.h:190:27: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
                        struct ipsec_encap_pdb encap_pdb;
                                               ^
1 warning generated.


More information about the dev mailing list