Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1712022lqs; Sun, 16 Jun 2024 00:58:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNfXnxTjCHz6DyjUhqMf2etGqmKYj7i1dp2zBiv9hCO7zkm14J+Vuis18tCmIeZnkPCsw0VOnoCBaZENLiEEYKCqKc4ofZ+kzhxsNmRA== X-Google-Smtp-Source: AGHT+IHAZ4dnH2baKBMHhXwa3kA9R4fyxYEBMu38kBtVCfvPwdNz1CBGu2y/nRK/Tf7DILpw6cdK X-Received: by 2002:a17:906:4690:b0:a6f:52e0:f1ea with SMTP id a640c23a62f3a-a6f60bcc9abmr436169666b.0.1718524713852; Sun, 16 Jun 2024 00:58:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718524713; cv=pass; d=google.com; s=arc-20160816; b=NRXpXgQILWwKQcIqEFPO8CVYl5evgI4ywU+bSk82cDWMLob2TnjpkuC9ngo0Swxppl Tsv0LrMPPdqivFPM84cfMV184/4MMoa6rNWUEgag8eAGzxJl302SYzKjda2UjSNpSyVy 9Kjd9kyjKNqXcypaxKskYdABY5khbC8fnfx8C8agT8ea1g/plgq/Pf+I7VvJLWO3yvEA eYIDifAbZXkheKb6G0N0rrYGnr01K53xf1VQ4gQWl5sAmzyWG15rD1UFLjix1eekLGLU ffpPcMxOxCCmouZds9Jd9RjcFDnBouU9XacpJwT4YFXg9uoBH46reW5Wg+zx8U/pvjdc zHRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9PkIY/+JvPRQH3lG8FJNGa1VEAbWJvoCrfAn8QG8UOQ=; fh=8cRT04hl59kK3s3p9zchIc4xH9DnqXv/QT0Hz9p5stM=; b=Y5YQH4e/DRqRuwYrpItGAEcnfDz43AS7AwQd/DFTUYGo7gf2rHiz2YxbvPYGX6ikm+ 0JrDeqm9TzMOLN/VLbrIEMJREZJFkIPOmnMdQR0n5YQlS4QmpxsiA+RuUaVw/AyCY+P2 X+50FhtvhpX0VJz/I43IMcNvLTTO4TI7Rgn9nTO80iX6dO639SQAm6HVgBjkfMISWNgu C6yTvPwBVPa3pJWY2DZpPGZ0SYyqkOQbD64kcHAFpj0qePUSKJMuQT8y6eKG3xbAUstT OopeICAAnuJE4SSWKCQalf7I6EPj2+INkmDcG/toYvVqjGCxAQYti++uTE3UWEI7DzYn frBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="Q/A1m8nE"; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-216182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d21527si334753866b.144.2024.06.16.00.58.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 00:58:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="Q/A1m8nE"; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-216182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8EFCC1F2157C for ; Sun, 16 Jun 2024 07:58:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56E30185080; Sun, 16 Jun 2024 07:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="Q/A1m8nE" Received: from msa.smtpout.orange.fr (smtp-74.smtpout.orange.fr [80.12.242.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27B3661FF1; Sun, 16 Jun 2024 07:58:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718524699; cv=none; b=iQlOzp3BCfGMlAs9pLXC138xBXO53UzwgFvXU4q3NWxddCm5j3b4TqQeIZe3jKPl9tXAL064G6p78m5WgD5GJ/itJ3coMx6geXTC5PW59Nw9qtW4QfPC+Wn9DsN/Hfa3eu/tVjRKLIy1HFl/WERsUFAYVuCAjoRiSXzjrV0yw/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718524699; c=relaxed/simple; bh=WRZv3PDO/c6mtg4LaKOXC6PUftDrcCyhmpjzZeaRBdw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eyj1A7VZVALMVvellVHZFv7S2EzrrxMf4U8inGILdacj6AyQIIdskoil2OeVqDovsUqe9gYoUy7k/aGgBuCHWv0MWy4alwlXr06MMxiRt2Fp6iH30xWlfnRRJpxfsubKXmK3JrE5XsuPd/5CqqlgRv33N0mmegZQremS/i5qAnI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=Q/A1m8nE; arc=none smtp.client-ip=80.12.242.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([86.243.222.230]) by smtp.orange.fr with ESMTPA id Ikm4sPtRXuRA3Ikm4selgw; Sun, 16 Jun 2024 09:58:09 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1718524689; bh=9PkIY/+JvPRQH3lG8FJNGa1VEAbWJvoCrfAn8QG8UOQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Q/A1m8nE15VUD/F2KcFqQih3WKQqzCifDKGM/2EAxMQuLgsA1LyLfRtrEmPYV+Vqd STY3RwYuI1z7WiPj9tuxMFpl1eBPybkYBaaz8Zu01+YPVXzoGpB9izrLaVD5wplg2i t8WoLktVjxlysIhGPNCEga6dOPNTE8k87gzCBdYwa/WCLrLca25kv8Gu5lggYiUf1O /3zzT/U2k55aKMYfPki78VajtGkxfrH2HqfYG+T65uxF1naq/n6Kt+LgZTfc1UQmkG egZmBWxCTSR193wV1xn33tEcGTLRucGFwUXesx9ySaEK9jR1sAYo487TUP4FusDu8V pnurseGbfG92w== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 16 Jun 2024 09:58:09 +0200 X-ME-IP: 86.243.222.230 From: Christophe JAILLET To: Horatiu Vultur , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , Daniel Machon Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next] net: microchip: Constify struct vcap_operations Date: Sun, 16 Jun 2024 09:57:56 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit "struct vcap_operations" are not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security. In order to do it, "struct vcap_control" also needs to be adjusted to this new const qualifier. As an example, on a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 15176 1094 16 16286 3f9e drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.o After: ===== text data bss dec hex filename 15268 998 16 16282 3f9a drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.o Signed-off-by: Christophe JAILLET --- I hope this can be applied as a single patch. I think it can be split between lan966x, sparx5 and vcap if really needed. --- drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c | 2 +- drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c | 2 +- drivers/net/ethernet/microchip/vcap/vcap_api.h | 2 +- drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c | 2 +- drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c b/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c index a4414f63c9b1..a1471e38d118 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c @@ -581,7 +581,7 @@ static void lan966x_vcap_move(struct net_device *dev, lan966x_vcap_wait_update(lan966x, admin->tgt_inst); } -static struct vcap_operations lan966x_vcap_ops = { +static const struct vcap_operations lan966x_vcap_ops = { .validate_keyset = lan966x_vcap_validate_keyset, .add_default_fields = lan966x_vcap_add_default_fields, .cache_erase = lan966x_vcap_cache_erase, diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c index 187efa1fc904..967c8621c250 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c @@ -1507,7 +1507,7 @@ static void sparx5_vcap_move(struct net_device *ndev, struct vcap_admin *admin, } } -static struct vcap_operations sparx5_vcap_ops = { +static const struct vcap_operations sparx5_vcap_ops = { .validate_keyset = sparx5_vcap_validate_keyset, .add_default_fields = sparx5_vcap_add_default_fields, .cache_erase = sparx5_vcap_cache_erase, diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.h b/drivers/net/ethernet/microchip/vcap/vcap_api.h index 9eccfa633c1a..6069ad95c27e 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api.h +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.h @@ -271,7 +271,7 @@ struct vcap_operations { /* VCAP API Client control interface */ struct vcap_control { - struct vcap_operations *ops; /* client supplied operations */ + const struct vcap_operations *ops; /* client supplied operations */ const struct vcap_info *vcaps; /* client supplied vcap models */ const struct vcap_statistics *stats; /* client supplied vcap stats */ struct list_head list; /* list of vcap instances */ diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c index b23c11b0647c..9c9d38042125 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c @@ -221,7 +221,7 @@ static int vcap_test_port_info(struct net_device *ndev, return 0; } -static struct vcap_operations test_callbacks = { +static const struct vcap_operations test_callbacks = { .validate_keyset = test_val_keyset, .add_default_fields = test_add_def_fields, .cache_erase = test_cache_erase, diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c index fe4e166de8a0..51d9423b08a6 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c @@ -211,7 +211,7 @@ static int vcap_test_port_info(struct net_device *ndev, return 0; } -static struct vcap_operations test_callbacks = { +static const struct vcap_operations test_callbacks = { .validate_keyset = test_val_keyset, .add_default_fields = test_add_def_fields, .cache_erase = test_cache_erase, -- 2.45.2