* [PATCH linux-next] kernfs: use strscpy() is more robust and safer
@ 2022-11-15 0:47 guo.ziliang
2022-11-15 6:43 ` Greg KH
2022-11-15 10:32 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: guo.ziliang @ 2022-11-15 0:47 UTC (permalink / raw)
To: gregkh; +Cc: tj, linux-kernel, guo.ziliang
From: guo ziliang <guo.ziliang@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: guo ziliang <guo.ziliang@zte.com.cn>
---
fs/kernfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 77d7a3a..fbb8df4 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -844,7 +844,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
spin_lock_irq(&kernfs_pr_cont_lock);
- len = strlcpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
+ len = strscpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
if (len >= sizeof(kernfs_pr_cont_buf)) {
spin_unlock_irq(&kernfs_pr_cont_lock);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] kernfs: use strscpy() is more robust and safer
2022-11-15 0:47 [PATCH linux-next] kernfs: use strscpy() is more robust and safer guo.ziliang
@ 2022-11-15 6:43 ` Greg KH
2022-11-15 10:32 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-11-15 6:43 UTC (permalink / raw)
To: guo.ziliang; +Cc: tj, linux-kernel
On Tue, Nov 15, 2022 at 08:47:45AM +0800, guo.ziliang@zte.com.cn wrote:
> From: guo ziliang <guo.ziliang@zte.com.cn>
>
> The implementation of strscpy() is more robust and safer.
How exactly is it more robust and safer?
> That's now the recommended way to copy NUL terminated strings.
Recommended by whom for what?
>
> Signed-off-by: guo ziliang <guo.ziliang@zte.com.cn>
> ---
> fs/kernfs/dir.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
> index 77d7a3a..fbb8df4 100644
> --- a/fs/kernfs/dir.c
> +++ b/fs/kernfs/dir.c
> @@ -844,7 +844,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
>
> spin_lock_irq(&kernfs_pr_cont_lock);
>
> - len = strlcpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
> + len = strscpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
How did you test this change is correct and does not cause any problems?
How was this issue found?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] kernfs: use strscpy() is more robust and safer
2022-11-15 0:47 [PATCH linux-next] kernfs: use strscpy() is more robust and safer guo.ziliang
2022-11-15 6:43 ` Greg KH
@ 2022-11-15 10:32 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-11-15 10:32 UTC (permalink / raw)
To: guo.ziliang; +Cc: tj, linux-kernel
On Tue, Nov 15, 2022 at 08:47:45AM +0800, guo.ziliang@zte.com.cn wrote:
> From: guo ziliang <guo.ziliang@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: guo ziliang <guo.ziliang@zte.com.cn>
Note, your email is showing up as "unvalidated" with in invalid
signature based on your domain. Please fix that up so that your patches
will be able to be accepted, otherwise we have to consider this as a
spoofed email :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-15 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-15 0:47 [PATCH linux-next] kernfs: use strscpy() is more robust and safer guo.ziliang
2022-11-15 6:43 ` Greg KH
2022-11-15 10:32 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox