diff options
author | Joel Granados <j.granados@samsung.com> | 2024-06-04 08:29:23 +0200 |
---|---|---|
committer | Joel Granados <j.granados@samsung.com> | 2024-06-13 10:50:52 +0200 |
commit | aef9d25e7f5631543a0276d0532151f2c61174d6 (patch) | |
tree | 1c93366724f77c13ba8cff35937993f321e27520 /fs/proc/proc_sysctl.c | |
parent | 55bb7eb62db4995cec7e309c2b9a1070cfd60eb6 (diff) |
sysctl: Remove superfluous empty allocations from sysctl internals
Now that the sentinels have been removed from ctl_table arrays, there is
no need to artificially append empty ctl_table elements at ctl_table
registration. Remove superfluous empty allocation from new_dir and
new_links.
Signed-off-by: Joel Granados <j.granados@samsung.com>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r-- | fs/proc/proc_sysctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index dc95a7bde1b3..ee1c48f854a2 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -949,14 +949,14 @@ static struct ctl_dir *new_dir(struct ctl_table_set *set, char *new_name; new = kzalloc(sizeof(*new) + sizeof(struct ctl_node) + - sizeof(struct ctl_table)*2 + namelen + 1, + sizeof(struct ctl_table) + namelen + 1, GFP_KERNEL); if (!new) return NULL; node = (struct ctl_node *)(new + 1); table = (struct ctl_table *)(node + 1); - new_name = (char *)(table + 2); + new_name = (char *)(table + 1); memcpy(new_name, name, namelen); table[0].procname = new_name; table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO; @@ -1175,7 +1175,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ links = kzalloc(sizeof(struct ctl_table_header) + sizeof(struct ctl_node)*head->ctl_table_size + - sizeof(struct ctl_table)*(head->ctl_table_size + 1) + + sizeof(struct ctl_table)*head->ctl_table_size + name_bytes, GFP_KERNEL); @@ -1184,7 +1184,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ node = (struct ctl_node *)(links + 1); link_table = (struct ctl_table *)(node + head->ctl_table_size); - link_name = (char *)&link_table[head->ctl_table_size + 1]; + link_name = (char *)(link_table + head->ctl_table_size); link = link_table; list_for_each_table_entry(entry, head) { |