[dpdk-stable] [17.11] net/mlx5: fix initialization of struct members
Yongseok Koh
yskoh at mellanox.com
Wed Jan 23 06:58:36 CET 2019
> On Jan 22, 2019, at 11:51 PM, Ali Alnubani <alialnu at mellanox.com> wrote:
>
> [ backported from upstream commit 0c15f3c010322853078c20a2a9926d3fb5986548 ]
>
> This patch fixes compilation errors with meson and the clang
> compiler caused by some of the struct members not being
> initialized.
>
> ```
> ../drivers/net/mlx5/mlx5_mr.c:345:37: error: missing field 'end'
> initializer [-Werror,-Wmissing-field-initializers]
> struct mlx5_mr_cache entry = { 0, };
> ^
> ../drivers/net/mlx5/mlx5_mr.c:389:36: error: missing field 'end'
> initializer [-Werror,-Wmissing-field-initializers]
> struct mlx5_mr_cache ret = { 0, };
> ^
> ../drivers/net/mlx5/mlx5_mr.c:691:35: error: missing field 'end'
> initializer [-Werror,-Wmissing-field-initializers]
> struct mlx5_mr_cache ret = { 0, };
> ^
> ```
>
> The compilation errors reproduce with
> clang version 3.4.2 (tags/RELEASE_34/dot2-final) on RHEL.
>
> Fixes: 87011737b715 ("mlx5: add software counters")
>
> Signed-off-by: Ali Alnubani <alialnu at mellanox.com>
> Acked-by: Shahaf Shuler <shahafs at mellanox.com>
> ---
Applied to stable/17.11
thanks,
Yongseok
> drivers/net/mlx5/mlx5_stats.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
> index 345ed7075..e880d24c5 100644
> --- a/drivers/net/mlx5/mlx5_stats.c
> +++ b/drivers/net/mlx5/mlx5_stats.c
> @@ -356,10 +356,11 @@ int
> mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> {
> struct priv *priv = dev->data->dev_private;
> - struct rte_eth_stats tmp = {0};
> + struct rte_eth_stats tmp;
> unsigned int i;
> unsigned int idx;
>
> + memset(&tmp, 0, sizeof(tmp));
> /* Add software counters. */
> for (i = 0; (i != priv->rxqs_n); ++i) {
> struct mlx5_rxq_data *rxq = (*priv->rxqs)[i];
> --
> 2.19.1
>
More information about the stable
mailing list