]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
eth: dpaa2: constify dpaa2_ethtool_stats and dpaa2_ethtool_extras
authorLen Bao <len.bao@gmx.us>
Sat, 23 May 2026 15:07:35 +0000 (15:07 +0000)
committerJakub Kicinski <kuba@kernel.org>
Mon, 25 May 2026 21:17:40 +0000 (14:17 -0700)
The 'dpaa2_ethtool_stats' and 'dpaa2_ethtool_extras' structures are
initialized in their declarations and never changed. So, constify them
to reduce the attack surface.

Before the patch (size dpaa2-ethtool.o):

   text    data     bss     dec     hex
  33433    5992       0   39425    9a01

After the patch (size dpaa2-ethtool.o):

   text    data     bss     dec     hex
  34937    4488       0   39425    9a01

Signed-off-by: Len Bao <len.bao@gmx.us>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://patch.msgid.link/20260523150737.36988-1-len.bao@gmx.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c

index 59f5c778df383c9432cf1ee5cbb74e10a179228a..fcc0a30a9d572e40575a234330cc47c5675ae8e1 100644 (file)
@@ -10,7 +10,7 @@
 #include "dpaa2-eth.h"
 
 /* To be kept in sync with DPNI statistics */
-static char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = {
+static const char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = {
        "[hw] rx frames",
        "[hw] rx bytes",
        "[hw] rx mcast frames",
@@ -37,7 +37,7 @@ static char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = {
 
 #define DPAA2_ETH_NUM_STATS    ARRAY_SIZE(dpaa2_ethtool_stats)
 
-static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = {
+static const char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = {
        /* per-cpu stats */
        "[drv] tx conf frames",
        "[drv] tx conf bytes",