]> git.baikalelectronics.ru Git - kernel.git/commit
IB/cma: use strlcpy() instead of strncpy()
authorXiongfeng Wang <xiongfeng.wang@linaro.org>
Fri, 12 Jan 2018 07:56:05 +0000 (15:56 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 15 Jan 2018 22:33:21 +0000 (15:33 -0700)
commitb0df1728b6115b67cd3d3ad14e11a878a0d62212
treed547bd757c8b86791a7fd2bd95e13bd51192ee4f
parent3088762a9808638ffc6956813b3f42a1889dd9ff
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>
drivers/infiniband/core/cma_configfs.c