diff mbox series

sysctl: minor cleanup in new_dir()

Message ID b1b9cf79-d0a8-bb9a-5dca-42ceb74ffcbf@openvz.org (mailing list archive)
State New, archived
Headers show
Series sysctl: minor cleanup in new_dir() | expand

Commit Message

Vasily Averin April 24, 2022, 6:28 p.m. UTC
Byte zeroing is not required here, since memory was allocated by kzalloc()

Signed-off-by: Vasily Averin <vvs@openvz.org>
---
 fs/proc/proc_sysctl.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Luis Chamberlain April 25, 2022, 8:51 p.m. UTC | #1
On Sun, Apr 24, 2022 at 09:28:54PM +0300, Vasily Averin wrote:
> Byte zeroing is not required here, since memory was allocated by kzalloc()
> 
> Signed-off-by: Vasily Averin <vvs@openvz.org>
> ---
>  fs/proc/proc_sysctl.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 7d9cfc730bd4..094c24e010ae 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -978,7 +978,6 @@ static struct ctl_dir *new_dir(struct ctl_table_set *set,
>  	table = (struct ctl_table *)(node + 1);
>  	new_name = (char *)(table + 2);
>  	memcpy(new_name, name, namelen);
> -	new_name[namelen] = '\0';
>  	table[0].procname = new_name;
>  	table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO;
>  	init_header(&new->header, set->dir.header.root, set, node, table);

Queued onto sysctl-testing, thanks!

  Luis
diff mbox series

Patch

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 7d9cfc730bd4..094c24e010ae 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -978,7 +978,6 @@  static struct ctl_dir *new_dir(struct ctl_table_set *set,
 	table = (struct ctl_table *)(node + 1);
 	new_name = (char *)(table + 2);
 	memcpy(new_name, name, namelen);
-	new_name[namelen] = '\0';
 	table[0].procname = new_name;
 	table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO;
 	init_header(&new->header, set->dir.header.root, set, node, table);