diff mbox series

[-next] parisc: pdc_stable: Constify struct kobj_type

Message ID 20240904011642.2010258-1-lihongbo22@huawei.com (mailing list archive)
State Accepted, archived
Headers show
Series [-next] parisc: pdc_stable: Constify struct kobj_type | expand

Commit Message

Hongbo Li Sept. 4, 2024, 1:16 a.m. UTC
This 'struct kobj_type' is not modified. It is only used in
kobject_init_and_add() which takes a 'const struct kobj_type *ktype'
parameter.

Constifying this structure and moving it to a read-only section,
and can increase over all security.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/parisc/pdc_stable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Helge Deller Sept. 4, 2024, 4:57 p.m. UTC | #1
On 9/4/24 03:16, Hongbo Li wrote:
> This 'struct kobj_type' is not modified. It is only used in
> kobject_init_and_add() which takes a 'const struct kobj_type *ktype'
> parameter.
>
> Constifying this structure and moving it to a read-only section,
> and can increase over all security.
>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

applied.

Thanks!
Helge
diff mbox series

Patch

diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 633266447e2f..16f4496bca95 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -483,7 +483,7 @@  static struct attribute *paths_subsys_attrs[] = {
 ATTRIBUTE_GROUPS(paths_subsys);
 
 /* Specific kobject type for our PDC paths */
-static struct kobj_type ktype_pdcspath = {
+static const struct kobj_type ktype_pdcspath = {
 	.sysfs_ops = &pdcspath_attr_ops,
 	.default_groups = paths_subsys_groups,
 };