live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] livepatch: Make kobj_type structures constant
@ 2023-02-17  3:14 Thomas Weißschuh
  2023-02-21 15:55 ` Petr Mladek
  2023-03-09 10:52 ` Petr Mladek
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2023-02-17  3:14 UTC (permalink / raw)
  To: Josh Poimboeuf, Jiri Kosina, Miroslav Benes, Petr Mladek, Joe Lawrence
  Cc: live-patching, linux-kernel, Thomas Weißschuh

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 <linux@weissschuh.net>
---
 kernel/livepatch/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 201f0c0482fb..3da548755d8a 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -581,7 +581,7 @@ static void klp_kobj_release_patch(struct kobject *kobj)
 	complete(&patch->finish);
 }
 
-static struct kobj_type klp_ktype_patch = {
+static const struct kobj_type klp_ktype_patch = {
 	.release = klp_kobj_release_patch,
 	.sysfs_ops = &kobj_sysfs_ops,
 	.default_groups = klp_patch_groups,
@@ -597,7 +597,7 @@ static void klp_kobj_release_object(struct kobject *kobj)
 		klp_free_object_dynamic(obj);
 }
 
-static struct kobj_type klp_ktype_object = {
+static const struct kobj_type klp_ktype_object = {
 	.release = klp_kobj_release_object,
 	.sysfs_ops = &kobj_sysfs_ops,
 	.default_groups = klp_object_groups,
@@ -613,7 +613,7 @@ static void klp_kobj_release_func(struct kobject *kobj)
 		klp_free_func_nop(func);
 }
 
-static struct kobj_type klp_ktype_func = {
+static const struct kobj_type klp_ktype_func = {
 	.release = klp_kobj_release_func,
 	.sysfs_ops = &kobj_sysfs_ops,
 };

---
base-commit: 3ac88fa4605ec98e545fb3ad0154f575fda2de5f
change-id: 20230217-kobj_type-livepatch-74ddff6d453f

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] livepatch: Make kobj_type structures constant
  2023-02-17  3:14 [PATCH] livepatch: Make kobj_type structures constant Thomas Weißschuh
@ 2023-02-21 15:55 ` Petr Mladek
  2023-03-09 10:52 ` Petr Mladek
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2023-02-21 15:55 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Josh Poimboeuf, Jiri Kosina, Miroslav Benes, Joe Lawrence,
	live-patching, linux-kernel

On Fri 2023-02-17 03:14:41, 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.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

PS: I am going to queue this patch for 6.4. I could eventually add
    it into a pull request for 6.3-rc if it was needed because of
    a more important fix.

    This patch is trivial. But even trivial patches should spend
    at least few days in linux-next...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] livepatch: Make kobj_type structures constant
  2023-02-17  3:14 [PATCH] livepatch: Make kobj_type structures constant Thomas Weißschuh
  2023-02-21 15:55 ` Petr Mladek
@ 2023-03-09 10:52 ` Petr Mladek
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2023-03-09 10:52 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Josh Poimboeuf, Jiri Kosina, Miroslav Benes, Joe Lawrence,
	live-patching, linux-kernel

On Fri 2023-02-17 03:14:41, 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.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

JFYI, the patch has been comitted into livepatching.git,
branch for-6.4/core.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-09 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-17  3:14 [PATCH] livepatch: Make kobj_type structures constant Thomas Weißschuh
2023-02-21 15:55 ` Petr Mladek
2023-03-09 10:52 ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).