All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] cgroup: use strscpy() is more robust and safer
@ 2022-09-21  9:35 ` cgel.zte-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 4+ messages in thread
From: cgel.zte @ 2022-09-21  9:35 UTC (permalink / raw)
  To: tj; +Cc: lizefan.x, hannes, cgroups, linux-kernel, ye xingchen

From: ye xingchen <ye.xingchen@zte.com.cn>

The implementation of strscpy() is more robust and safer.

That's now the recommended way to copy NUL terminated strings.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 kernel/cgroup/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 829aa42e773e..48a8e8fb3e91 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2374,7 +2374,7 @@ int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen)
 		ret = cgroup_path_ns_locked(cgrp, buf, buflen, &init_cgroup_ns);
 	} else {
 		/* if no hierarchy exists, everyone is in "/" */
-		ret = strlcpy(buf, "/", buflen);
+		ret = strscpy(buf, "/", buflen);
 	}
 
 	spin_unlock_irq(&css_set_lock);
-- 
2.25.1

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

* [PATCH linux-next] cgroup: use strscpy() is more robust and safer
@ 2022-09-21  9:35 ` cgel.zte-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 4+ messages in thread
From: cgel.zte-Re5JQEeQqe8AvxtiuMwx3w @ 2022-09-21  9:35 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A
  Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, ye xingchen

From: ye xingchen <ye.xingchen-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>

The implementation of strscpy() is more robust and safer.

That's now the recommended way to copy NUL terminated strings.

Signed-off-by: ye xingchen <ye.xingchen-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
---
 kernel/cgroup/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 829aa42e773e..48a8e8fb3e91 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2374,7 +2374,7 @@ int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen)
 		ret = cgroup_path_ns_locked(cgrp, buf, buflen, &init_cgroup_ns);
 	} else {
 		/* if no hierarchy exists, everyone is in "/" */
-		ret = strlcpy(buf, "/", buflen);
+		ret = strscpy(buf, "/", buflen);
 	}
 
 	spin_unlock_irq(&css_set_lock);
-- 
2.25.1

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

* Re: [PATCH linux-next] cgroup: use strscpy() is more robust and safer
@ 2022-09-24  3:27   ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2022-09-24  3:27 UTC (permalink / raw)
  To: cgel.zte; +Cc: lizefan.x, hannes, cgroups, linux-kernel, ye xingchen

On Wed, Sep 21, 2022 at 09:35:17AM +0000, cgel.zte@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> The implementation of strscpy() is more robust and safer.
> 
> That's now the recommended way to copy NUL terminated strings.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>

Applied to cgroup/for-6.1.

Thanks.

-- 
tejun

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

* Re: [PATCH linux-next] cgroup: use strscpy() is more robust and safer
@ 2022-09-24  3:27   ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2022-09-24  3:27 UTC (permalink / raw)
  To: cgel.zte-Re5JQEeQqe8AvxtiuMwx3w
  Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, ye xingchen

On Wed, Sep 21, 2022 at 09:35:17AM +0000, cgel.zte-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> From: ye xingchen <ye.xingchen-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
> 
> The implementation of strscpy() is more robust and safer.
> 
> That's now the recommended way to copy NUL terminated strings.
> 
> Signed-off-by: ye xingchen <ye.xingchen-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>

Applied to cgroup/for-6.1.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2022-09-24  3:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21  9:35 [PATCH linux-next] cgroup: use strscpy() is more robust and safer cgel.zte
2022-09-21  9:35 ` cgel.zte-Re5JQEeQqe8AvxtiuMwx3w
2022-09-24  3:27 ` Tejun Heo
2022-09-24  3:27   ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.