diff options
author | Yan, Zheng <zyan@redhat.com> | 2018-07-02 03:55:23 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-08-02 15:26:11 -0400 |
commit | dfeb84d4adfda0448b013b8aae2cc5c95eb27ccd (patch) | |
tree | 0bb58bff6edace8d84495cfeb9211d80563ec90c | |
parent | b26c047b940003295d3896b7f633a66aab95bebd (diff) |
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: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | fs/ceph/mds_client.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index dc8bc664a871..f1590256d2e6 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -3644,8 +3644,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) | |||
3644 | init_rwsem(&mdsc->pool_perm_rwsem); | 3644 | init_rwsem(&mdsc->pool_perm_rwsem); |
3645 | mdsc->pool_perm_tree = RB_ROOT; | 3645 | mdsc->pool_perm_tree = RB_ROOT; |
3646 | 3646 | ||
3647 | strncpy(mdsc->nodename, utsname()->nodename, | 3647 | strscpy(mdsc->nodename, utsname()->nodename, |
3648 | sizeof(mdsc->nodename) - 1); | 3648 | sizeof(mdsc->nodename)); |
3649 | return 0; | 3649 | return 0; |
3650 | } | 3650 | } |
3651 | 3651 | ||