2023-02-11 03:32:51

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 0/3] net: make kobj_type structures constant

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definitions to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <[email protected]>
Signed-off-by: Thomas Weißschuh <[email protected]>
---
Thomas Weißschuh (3):
net: bridge: make kobj_type structure constant
net-sysfs: make kobj_type structures constant
SUNRPC: make kobj_type structures constant

net/bridge/br_if.c | 2 +-
net/core/net-sysfs.c | 4 ++--
net/sunrpc/sysfs.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
---
base-commit: 420b2d431d18a2572c8e86579e78105cb5ed45b0
change-id: 20230211-kobj_type-net-99f71346aed2

Best regards,
--
Thomas Weißschuh <[email protected]>



2023-02-11 03:32:53

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 1/3] net: bridge: make kobj_type structure constant

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
net/bridge/br_if.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index ad13b48e3e08..24f01ff113f0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -269,7 +269,7 @@ static void brport_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t
net_ns_get_ownership(dev_net(p->dev), uid, gid);
}

-static struct kobj_type brport_ktype = {
+static const struct kobj_type brport_ktype = {
#ifdef CONFIG_SYSFS
.sysfs_ops = &brport_sysfs_ops,
#endif

--
2.39.1


2023-02-14 04:11:41

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH 0/3] net: make kobj_type structures constant

On Sat, 11 Feb 2023 03:32:28 +0000 Thomas Weißschuh wrote:
> Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> the driver core allows the usage of const struct kobj_type.
>
> Take advantage of this to constify the structure definitions to prevent
> modification at runtime.

Could you resend just the first two with [PATCH net-next] in the
subject? Patch 3 needs to go to a different tree.