gve: Use size_add() in call to struct_size()
[platform/kernel/linux-starfive.git] / drivers / net / ethernet / google / gve / gve_main.c
index 5704b5f..83b09dc 100644 (file)
@@ -190,7 +190,7 @@ static int gve_alloc_stats_report(struct gve_priv *priv)
        rx_stats_num = (GVE_RX_STATS_REPORT_NUM + NIC_RX_STATS_REPORT_NUM) *
                       priv->rx_cfg.num_queues;
        priv->stats_report_len = struct_size(priv->stats_report, stats,
-                                            tx_stats_num + rx_stats_num);
+                                            size_add(tx_stats_num, rx_stats_num));
        priv->stats_report =
                dma_alloc_coherent(&priv->pdev->dev, priv->stats_report_len,
                                   &priv->stats_report_bus, GFP_KERNEL);