public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Doug Ledford <dledford@redhat.com>
Cc: <linux-rdma@vger.kernel.org>, Gal Pressman <galpress@amazon.com>,
	Firas JahJah <firasj@amazon.com>,
	Yossi Leybovich <sleybo@amazon.com>
Subject: [PATCH for-next] RDMA/efa: Use strscpy instead of strlcpy
Date: Tue, 16 Mar 2021 15:24:16 +0200	[thread overview]
Message-ID: <20210316132416.83578-1-galpress@amazon.com> (raw)

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>
---
 drivers/infiniband/hw/efa/efa_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index 0f578734bddb..a8da96ef2be8 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,10 +209,10 @@ static void efa_set_host_info(struct efa_dev *dev)
 	if (!hinf)
 		return;
 
-	strlcpy(hinf->os_dist_str, utsname()->release,
+	strscpy(hinf->os_dist_str, utsname()->release,
 		min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
 	hinf->os_type = EFA_ADMIN_OS_LINUX;
-	strlcpy(hinf->kernel_ver_str, utsname()->version,
+	strscpy(hinf->kernel_ver_str, utsname()->version,
 		min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
 	hinf->kernel_ver = LINUX_VERSION_CODE;
 	EFA_SET(&hinf->driver_ver, EFA_ADMIN_HOST_INFO_DRIVER_MAJOR, 0);
-- 
2.31.0


             reply	other threads:[~2021-03-16 13:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 13:24 Gal Pressman [this message]
2021-03-22 13:01 ` [PATCH for-next] RDMA/efa: Use strscpy instead of strlcpy Jason Gunthorpe
2021-03-22 13:11   ` Gal Pressman
2021-03-22 16:55     ` Jason Gunthorpe
2021-03-22 17:14       ` Gal Pressman
2021-03-23  0:21         ` Jason Gunthorpe
2021-03-29  7:04           ` Gal Pressman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210316132416.83578-1-galpress@amazon.com \
    --to=galpress@amazon.com \
    --cc=dledford@redhat.com \
    --cc=firasj@amazon.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sleybo@amazon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox