Message ID | 20240904011434.2010118-1-lihongbo22@huawei.com (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | [-next] power: supply: Constify struct kobj_type | expand |
On Wed, 04 Sep 2024 09:14:34 +0800, 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. > > [...] Applied, thanks! [1/1] power: supply: Constify struct kobj_type commit: eb1ea1351da0196e355391b4aa7f8a58536f16e6 Best regards,
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 270874eeb934..a71903b1bf78 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -2531,7 +2531,7 @@ static struct attribute *ab8500_fg_attrs[] = { }; ATTRIBUTE_GROUPS(ab8500_fg); -static struct kobj_type ab8500_fg_ktype = { +static const struct kobj_type ab8500_fg_ktype = { .sysfs_ops = &ab8500_fg_sysfs_ops, .default_groups = ab8500_fg_groups, };
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/power/supply/ab8500_fg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)