mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sysctl: minor cleanup in new_dir()
@ 2022-04-24 18:28 Vasily Averin
  2022-04-25 20:51 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: Vasily Averin @ 2022-04-24 18:28 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Luis Chamberlain, Kees Cook, Iurii Zaikin, kernel

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);
-- 
2.25.1


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

* Re: [PATCH] sysctl: minor cleanup in new_dir()
  2022-04-24 18:28 [PATCH] sysctl: minor cleanup in new_dir() Vasily Averin
@ 2022-04-25 20:51 ` Luis Chamberlain
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2022-04-25 20:51 UTC (permalink / raw)
  To: Vasily Averin
  Cc: linux-fsdevel, linux-kernel, Kees Cook, Iurii Zaikin, kernel

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

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

end of thread, other threads:[~2022-04-25 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 18:28 [PATCH] sysctl: minor cleanup in new_dir() Vasily Averin
2022-04-25 20:51 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®