From: Yan, Zheng Date: Mon, 2 Jul 2018 07:55:23 +0000 (+0800) Subject: ceph: fix incorrect use of strncpy X-Git-Tag: v4.19~346^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dfeb84d4adfda0448b013b8aae2cc5c95eb27ccd;p=platform%2Fkernel%2Flinux-rpi.git 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" Reviewed-by: Ilya Dryomov Signed-off-by: Ilya Dryomov --- diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index dc8bc66..f159025 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) init_rwsem(&mdsc->pool_perm_rwsem); mdsc->pool_perm_tree = RB_ROOT; - strncpy(mdsc->nodename, utsname()->nodename, - sizeof(mdsc->nodename) - 1); + strscpy(mdsc->nodename, utsname()->nodename, + sizeof(mdsc->nodename)); return 0; }