* [PATCH linux-next] fs/super.c: use strscpy() is more robust and safer
@ 2022-10-20 3:09 cuijinpeng666
2022-10-20 9:47 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: cuijinpeng666 @ 2022-10-20 3:09 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel, Jinpeng Cui, Zeal Robot
From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
The implementation of strscpy() is more robust and safer.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
---
fs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/super.c b/fs/super.c
index 8d39e4f11cfa..ca791da59c98 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -574,7 +574,7 @@ struct super_block *sget_fc(struct fs_context *fc,
fc->s_fs_info = NULL;
s->s_type = fc->fs_type;
s->s_iflags |= fc->s_iflags;
- strlcpy(s->s_id, s->s_type->name, sizeof(s->s_id));
+ strscpy(s->s_id, s->s_type->name, sizeof(s->s_id));
list_add_tail(&s->s_list, &super_blocks);
hlist_add_head(&s->s_instances, &s->s_type->fs_supers);
spin_unlock(&sb_lock);
@@ -653,7 +653,7 @@ struct super_block *sget(struct file_system_type *type,
return ERR_PTR(err);
}
s->s_type = type;
- strlcpy(s->s_id, type->name, sizeof(s->s_id));
+ strscpy(s->s_id, type->name, sizeof(s->s_id));
list_add_tail(&s->s_list, &super_blocks);
hlist_add_head(&s->s_instances, &type->fs_supers);
spin_unlock(&sb_lock);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-20 9:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 3:09 [PATCH linux-next] fs/super.c: use strscpy() is more robust and safer cuijinpeng666
2022-10-20 9:47 ` Greg KH
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®