* [PATCH] IB/cma: use strlcpy() instead of strncpy()
@ 2018-01-12 7:56 ` Xiongfeng Wang
0 siblings, 0 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2018-01-12 7:56 UTC (permalink / raw)
To: jgg, linux-rdma, linux-kernel, wangxiongfeng2; +Cc: arnd
From: Xiongfeng Wang <xiongfeng.wang@linaro.org>
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>
---
drivers/infiniband/core/cma_configfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 31dfee0..eee38b4 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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] IB/cma: use strlcpy() instead of strncpy()
@ 2018-01-12 7:56 ` Xiongfeng Wang
0 siblings, 0 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2018-01-12 7:56 UTC (permalink / raw)
To: jgg, linux-rdma, linux-kernel, wangxiongfeng2; +Cc: arnd
From: Xiongfeng Wang <xiongfeng.wang@linaro.org>
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>
---
drivers/infiniband/core/cma_configfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 31dfee0..eee38b4 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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IB/cma: use strlcpy() instead of strncpy()
2018-01-12 7:56 ` Xiongfeng Wang
(?)
@ 2018-01-12 11:43 ` Leon Romanovsky
-1 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2018-01-12 11:43 UTC (permalink / raw)
To: Xiongfeng Wang; +Cc: jgg, linux-rdma, linux-kernel, arnd
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
On Fri, Jan 12, 2018 at 03:56:05PM +0800, Xiongfeng Wang wrote:
> From: Xiongfeng Wang <xiongfeng.wang@linaro.org>
>
> 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>
> ---
> drivers/infiniband/core/cma_configfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] IB/cma: use strlcpy() instead of strncpy()
2018-01-12 7:56 ` Xiongfeng Wang
(?)
(?)
@ 2018-01-15 23:04 ` Jason Gunthorpe
-1 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2018-01-15 23:04 UTC (permalink / raw)
To: Xiongfeng Wang; +Cc: linux-rdma, linux-kernel, arnd
On Fri, Jan 12, 2018 at 03:56:05PM +0800, Xiongfeng Wang wrote:
> From: Xiongfeng Wang <xiongfeng.wang@linaro.org>
>
> 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>
> drivers/infiniband/core/cma_configfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to rdma for-next, thanks
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-15 23:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12 7:56 [PATCH] IB/cma: use strlcpy() instead of strncpy() Xiongfeng Wang
2018-01-12 7:56 ` Xiongfeng Wang
2018-01-12 11:43 ` Leon Romanovsky
2018-01-15 23:04 ` Jason Gunthorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.