diff options
author | Xiongfeng Wang <xiongfeng.wang@linaro.org> | 2018-01-12 15:56:05 +0800 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-01-15 15:33:21 -0700 |
commit | 979a459c8347a797fd03717a3f12289c91617982 (patch) | |
tree | d547bd757c8b86791a7fd2bd95e13bd51192ee4f /drivers/infiniband/core | |
parent | a6532e7139660c103dda181aa5b2c734aa26ed6c (diff) | |
download | linux-979a459c8347a797fd03717a3f12289c91617982.tar.bz2 |
IB/cma: use strlcpy() instead of strncpy()
gcc-8 reports
drivers/infiniband/core/cma_configfs.c: In function 'make_cma_dev':
./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
bound 64 equals destination size [-Wstringop-truncation]
We need to use strlcpy() to make sure the string is nul-terminated.
Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/cma_configfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c index 31dfee0c8295..eee38b40be99 100644 --- a/drivers/infiniband/core/cma_configfs.c +++ b/drivers/infiniband/core/cma_configfs.c @@ -295,7 +295,7 @@ static struct config_group *make_cma_dev(struct config_group *group, goto fail; } - strncpy(cma_dev_group->name, name, sizeof(cma_dev_group->name)); + strlcpy(cma_dev_group->name, name, sizeof(cma_dev_group->name)); config_group_init_type_name(&cma_dev_group->ports_group, "ports", &cma_ports_group_type); |