提交 dfeb84d4 编写于 作者: Y Yan, Zheng 提交者: Ilya Dryomov

ceph: fix incorrect use of strncpy

GCC8 prints following warning:

 fs/ceph/mds_client.c:3683:2: warning: ‘strncpy’ output may be truncated
 copying 64 bytes from a string of length 64 [-Wstringop-truncation]

[ Change to strscpy() while at it. ]
Signed-off-by: N"Yan, Zheng" <zyan@redhat.com>
Reviewed-by: NIlya Dryomov <idryomov@gmail.com>
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
上级 b26c047b
...@@ -3644,8 +3644,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) ...@@ -3644,8 +3644,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
init_rwsem(&mdsc->pool_perm_rwsem); init_rwsem(&mdsc->pool_perm_rwsem);
mdsc->pool_perm_tree = RB_ROOT; mdsc->pool_perm_tree = RB_ROOT;
strncpy(mdsc->nodename, utsname()->nodename, strscpy(mdsc->nodename, utsname()->nodename,
sizeof(mdsc->nodename) - 1); sizeof(mdsc->nodename));
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册