From nobody Fri Sep 12 09:02:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE766C636D4 for ; Sat, 11 Feb 2023 03:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbjBKDcw (ORCPT ); Fri, 10 Feb 2023 22:32:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbjBKDcn (ORCPT ); Fri, 10 Feb 2023 22:32:43 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A00BD3A084; Fri, 10 Feb 2023 19:32:41 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1676086359; bh=xCR+Ptx6qu9QePzl0md5Tsxq8IclLdgajMp2skUDWSc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tjJ371sCoO1zJbo7cmqZNdMb2QRhvV5t2iWk3im7znsFjqLfTX/pxHH+uAaL8a9T3 //NN5GCYPGBaQNtuHZl/sOPwyAbUxmGvYLUk2mOQqZiNNXsxDLa9gwihMyiRwev3bM lsI/Jq58r6WgjI+MSMGDizgdXvwVN9El+6D6fZl4= Date: Sat, 11 Feb 2023 03:32:29 +0000 Subject: [PATCH 1/3] net: bridge: make kobj_type structure constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230211-kobj_type-net-v1-1-e3bdaa5d8a78@weissschuh.net> References: <20230211-kobj_type-net-v1-0-e3bdaa5d8a78@weissschuh.net> In-Reply-To: <20230211-kobj_type-net-v1-0-e3bdaa5d8a78@weissschuh.net> To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676086354; l=853; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=xCR+Ptx6qu9QePzl0md5Tsxq8IclLdgajMp2skUDWSc=; b=3aDYol7gtnPLDHJSwXBlVN4BDObAVRLqF9OMQ5NSZZNm/Q0NK+m80glqETx4nA62qGsG3Sn2R BipVF0Z8vquDqfEi5RLD7lwkMmJIy5wI/KI1M5EXd10qNp9hM5WxpaY X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=C3=9Fschuh --- 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); } =20 -static struct kobj_type brport_ktype =3D { +static const struct kobj_type brport_ktype =3D { #ifdef CONFIG_SYSFS .sysfs_ops =3D &brport_sysfs_ops, #endif --=20 2.39.1 From nobody Fri Sep 12 09:02:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DCB1C64ED6 for ; Sat, 11 Feb 2023 03:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229721AbjBKDco (ORCPT ); Fri, 10 Feb 2023 22:32:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjBKDcm (ORCPT ); Fri, 10 Feb 2023 22:32:42 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CE943A082; Fri, 10 Feb 2023 19:32:41 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1676086359; bh=XNGLB3UhxdSqVyS81dpprAvvvxiF/US4JFBcP36WqyI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TsVKORG2ywrtpfm4DmD/RciB0Q70iniNRqU3YZMfhUrPo8BlVGnjvQD1j18vz6f7C rg4yrkc2aBUmwmp7A+n52xbKwFTa+KYi05N8ajOAY7plh8T/UkEMHwKv0N+hMjoEPc AeRp6bR0fFjXBBtDCga1AjeMqkBWSRiG7AtnZP54= Date: Sat, 11 Feb 2023 03:32:30 +0000 Subject: [PATCH 2/3] net-sysfs: make kobj_type structures constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230211-kobj_type-net-v1-2-e3bdaa5d8a78@weissschuh.net> References: <20230211-kobj_type-net-v1-0-e3bdaa5d8a78@weissschuh.net> In-Reply-To: <20230211-kobj_type-net-v1-0-e3bdaa5d8a78@weissschuh.net> To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676086354; l=1293; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=XNGLB3UhxdSqVyS81dpprAvvvxiF/US4JFBcP36WqyI=; b=O08tGpao+GixD5fwjmhZwJyZf4Ds2If3+D7Hs7g4BjKYhk9/FQE3HQxNJOzX6oHM6tg8tw42N gmlshEAXEk0DH6Ktt7IXEHJMNgtZwGFS6e0EpBp1Pa9JQLrpmu5a3Pf X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=C3=9Fschuh --- net/core/net-sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index ca55dd747d6c..a3771bba841a 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1040,7 +1040,7 @@ static void rx_queue_get_ownership(const struct kobje= ct *kobj, net_ns_get_ownership(net, uid, gid); } =20 -static struct kobj_type rx_queue_ktype __ro_after_init =3D { +static const struct kobj_type rx_queue_ktype =3D { .sysfs_ops =3D &rx_queue_sysfs_ops, .release =3D rx_queue_release, .default_groups =3D rx_queue_default_groups, @@ -1643,7 +1643,7 @@ static void netdev_queue_get_ownership(const struct k= object *kobj, net_ns_get_ownership(net, uid, gid); } =20 -static struct kobj_type netdev_queue_ktype __ro_after_init =3D { +static const struct kobj_type netdev_queue_ktype =3D { .sysfs_ops =3D &netdev_queue_sysfs_ops, .release =3D netdev_queue_release, .default_groups =3D netdev_queue_default_groups, --=20 2.39.1 From nobody Fri Sep 12 09:02:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C51E3C61DA4 for ; Sat, 11 Feb 2023 03:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjBKDcq (ORCPT ); Fri, 10 Feb 2023 22:32:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjBKDcl (ORCPT ); Fri, 10 Feb 2023 22:32:41 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107E83A080; Fri, 10 Feb 2023 19:32:41 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1676086359; bh=Dnmm9EisyiwPWuqnhssGEUllu7crqwubee2hNSJAG8M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UjNXQ4sAm7gTMcAakOeheIUjKxttHPo9C+4JiCsux7rS5UwNSceKBz3Shzghl6KKu OQhOEHOSPTivXqHhxF63huaf28WpWD1y3OvnSm304qTiT/OrfydCE8paw+1zS9BtBi tlcoz9c31vKJr0p+viUNWg9mSuXcmilCnhgVNVDo= Date: Sat, 11 Feb 2023 03:32:31 +0000 Subject: [PATCH 3/3] SUNRPC: make kobj_type structures constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230211-kobj_type-net-v1-3-e3bdaa5d8a78@weissschuh.net> References: <20230211-kobj_type-net-v1-0-e3bdaa5d8a78@weissschuh.net> In-Reply-To: <20230211-kobj_type-net-v1-0-e3bdaa5d8a78@weissschuh.net> To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676086354; l=1793; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Dnmm9EisyiwPWuqnhssGEUllu7crqwubee2hNSJAG8M=; b=onqdqhxHmXHKN3enPa0T1Gz+7MRmxgAzhxlzCohHIJ/hJg/Czxo1RYAbabMEPlV0N+RLZ5GqH xsbzqvl8cG2Bd5xlzMTSFa68hl+5U9j2Z1xgWzALMttXy92f2Ixd6zp X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=C3=9Fschuh --- net/sunrpc/sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 1e05a2d723f4..0d0db4e1064e 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -36,7 +36,7 @@ rpc_sysfs_object_child_ns_type(const struct kobject *kobj) return &net_ns_type_operations; } =20 -static struct kobj_type rpc_sysfs_object_type =3D { +static const struct kobj_type rpc_sysfs_object_type =3D { .release =3D rpc_sysfs_object_release, .sysfs_ops =3D &kobj_sysfs_ops, .child_ns_type =3D rpc_sysfs_object_child_ns_type, @@ -427,20 +427,20 @@ static struct attribute *rpc_sysfs_xprt_switch_attrs[= ] =3D { }; ATTRIBUTE_GROUPS(rpc_sysfs_xprt_switch); =20 -static struct kobj_type rpc_sysfs_client_type =3D { +static const struct kobj_type rpc_sysfs_client_type =3D { .release =3D rpc_sysfs_client_release, .sysfs_ops =3D &kobj_sysfs_ops, .namespace =3D rpc_sysfs_client_namespace, }; =20 -static struct kobj_type rpc_sysfs_xprt_switch_type =3D { +static const struct kobj_type rpc_sysfs_xprt_switch_type =3D { .release =3D rpc_sysfs_xprt_switch_release, .default_groups =3D rpc_sysfs_xprt_switch_groups, .sysfs_ops =3D &kobj_sysfs_ops, .namespace =3D rpc_sysfs_xprt_switch_namespace, }; =20 -static struct kobj_type rpc_sysfs_xprt_type =3D { +static const struct kobj_type rpc_sysfs_xprt_type =3D { .release =3D rpc_sysfs_xprt_release, .default_groups =3D rpc_sysfs_xprt_groups, .sysfs_ops =3D &kobj_sysfs_ops, --=20 2.39.1