[dpdk-dev] [PATCH 2/2] drivers/crypto: Fix anonymous union initialization in crypto

Trahe, Fiona fiona.trahe at intel.com
Fri Mar 25 11:48:22 CET 2016



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Michael Qiu
> Sent: Friday, March 25, 2016 7:20 AM
> To: dev at dpdk.org
> Cc: Qiu, Michael
> Subject: [dpdk-dev] [PATCH 2/2] drivers/crypto: Fix anonymous union
> initialization in crypto
> 
> In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue:
> 	null_crypto_pmd_ops.c:44:3: error:
> 		unknown field ‘sym’ specified in initializer
> 	cc1: warnings being treated as errors
> 
> The member in anonymous union initialization should be inside '{}', otherwise it
> will report an error.
> 
> Fixes: 26c2e4ad5ad4 ("cryptodev: add capabilities discovery")
> 
> Signed-off-by: Michael Qiu <michael.qiu at intel.com>


Initialisation in QAT PMD has same issue, possibly also other PMDs.
I'll extend this fix where needed.

> ---
>  drivers/crypto/null/null_crypto_pmd_ops.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c
> b/drivers/crypto/null/null_crypto_pmd_ops.c
> index 39f8088..b7470c0 100644
> --- a/drivers/crypto/null/null_crypto_pmd_ops.c
> +++ b/drivers/crypto/null/null_crypto_pmd_ops.c
> @@ -41,9 +41,9 @@
>  static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {
>  	{	/* NULL (AUTH) */
>  		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
> -		.sym = {
> +		{.sym = {
>  			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
> -			.auth = {
> +			{.auth = {
>  				.algo = RTE_CRYPTO_AUTH_NULL,
>  				.block_size = 1,
>  				.key_size = {
> @@ -57,14 +57,14 @@ static const struct rte_cryptodev_capabilities
> null_crypto_pmd_capabilities[] =
>  					.increment = 0
>  				},
>  				.aad_size = { 0 }
> -			}
> -		}
> +			}, },
> +		}, },
>  	},
>  	{	/* NULL (CIPHER) */
>  		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
> -		.sym = {
> +		{.sym = {
>  			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
> -			.cipher = {
> +			{.cipher = {
>  				.algo = RTE_CRYPTO_CIPHER_NULL,
>  				.block_size = 1,
>  				.key_size = {
> @@ -77,8 +77,8 @@ static const struct rte_cryptodev_capabilities
> null_crypto_pmd_capabilities[] =
>  					.max = 0,
>  					.increment = 0
>  				}
> -			}
> -		}
> +			}, },
> +		}, },
>  	},
>  	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
>  };
> --
> 1.9.3



More information about the dev mailing list