* [PATCH for-next v2] RDMA/efa: Use strscpy instead of strlcpy
@ 2021-03-29 12:01 Gal Pressman
2021-03-30 20:04 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Gal Pressman @ 2021-03-29 12:01 UTC (permalink / raw)
To: Jason Gunthorpe, Doug Ledford
Cc: linux-rdma, Gal Pressman, Firas JahJah, Yossi Leybovich
The strlcpy function doesn't limit the source length, use the preferred
strscpy function instead.
Reviewed-by: Firas JahJah <firasj@amazon.com>
Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
v1->v2: https://lore.kernel.org/linux-rdma/20210316132416.83578-1-galpress@amazon.com/
* Remove the min() in the length argument (Jason)
---
drivers/infiniband/hw/efa/efa_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index 0f578734bddb..816cfd65b7ac 100644
--- a/drivers/infiniband/hw/efa/efa_main.c
+++ b/drivers/infiniband/hw/efa/efa_main.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
/*
- * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
*/
#include <linux/module.h>
@@ -209,11 +209,11 @@ static void efa_set_host_info(struct efa_dev *dev)
if (!hinf)
return;
- strlcpy(hinf->os_dist_str, utsname()->release,
- min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
+ strscpy(hinf->os_dist_str, utsname()->release,
+ sizeof(hinf->os_dist_str));
hinf->os_type = EFA_ADMIN_OS_LINUX;
- strlcpy(hinf->kernel_ver_str, utsname()->version,
- min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
+ strscpy(hinf->kernel_ver_str, utsname()->version,
+ sizeof(hinf->kernel_ver_str));
hinf->kernel_ver = LINUX_VERSION_CODE;
EFA_SET(&hinf->driver_ver, EFA_ADMIN_HOST_INFO_DRIVER_MAJOR, 0);
EFA_SET(&hinf->driver_ver, EFA_ADMIN_HOST_INFO_DRIVER_MINOR, 0);
base-commit: 783cf673b05ebf290317f583ee7eb6967ed9c964
--
2.31.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-next v2] RDMA/efa: Use strscpy instead of strlcpy
2021-03-29 12:01 [PATCH for-next v2] RDMA/efa: Use strscpy instead of strlcpy Gal Pressman
@ 2021-03-30 20:04 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-03-30 20:04 UTC (permalink / raw)
To: Gal Pressman; +Cc: Doug Ledford, linux-rdma, Firas JahJah, Yossi Leybovich
On Mon, Mar 29, 2021 at 03:01:28PM +0300, Gal Pressman wrote:
> The strlcpy function doesn't limit the source length, use the preferred
> strscpy function instead.
>
> Reviewed-by: Firas JahJah <firasj@amazon.com>
> Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
> Signed-off-by: Gal Pressman <galpress@amazon.com>
> ---
> v1->v2: https://lore.kernel.org/linux-rdma/20210316132416.83578-1-galpress@amazon.com/
> * Remove the min() in the length argument (Jason)
> ---
> drivers/infiniband/hw/efa/efa_main.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-30 20:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 12:01 [PATCH for-next v2] RDMA/efa: Use strscpy instead of strlcpy Gal Pressman
2021-03-30 20: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.