linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Ian Abbott <abbotti@mev.co.uk>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Ioana Radulescu <ruxandra.radulescu@nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
	Vaibhav Agarwal <vaibhav.sr@gmail.com>,
	Mark Greer <mgreer@animalcreek.com>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	Viresh Kumar <vireshk@kernel.org>,
	Marc Dietrich <marvin24@gmx.de>,
	Jens Frederich <jfrederich@gmail.com>,
	Daniel Drake <dsd@laptop.org>,
	Jon Nettleton <jon.nettleton@gmail.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Teddy Wang <teddy.wang@siliconmotion.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	William Cohen <wcohen@redhat.com>,
	Mike Rapoport <rppt@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Robert Richter <rric@kernel.org>,
	greybus-dev@lists.linaro.org, ac100@lists.launchpad.net,
	linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org
Subject: [PATCH 02/13] staging: greybus: Switch from strlcpy to strscpy
Date: Sun, 31 Jan 2021 22:58:23 +0530	[thread overview]
Message-ID: <20210131172838.146706-3-memxor@gmail.com> (raw)
In-Reply-To: <20210131172838.146706-1-memxor@gmail.com>

strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

This silences the related checkpatch warnings from:
5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy")

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 drivers/staging/greybus/audio_helper.c   | 2 +-
 drivers/staging/greybus/audio_module.c   | 2 +-
 drivers/staging/greybus/audio_topology.c | 6 +++---
 drivers/staging/greybus/power_supply.c   | 2 +-
 drivers/staging/greybus/spilib.c         | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c
index 3011b8abc..1ed4772d2 100644
--- a/drivers/staging/greybus/audio_helper.c
+++ b/drivers/staging/greybus/audio_helper.c
@@ -166,7 +166,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev,
 			snprintf(id.name, sizeof(id.name), "%s %s", prefix,
 				 control->name);
 		else
-			strlcpy(id.name, control->name, sizeof(id.name));
+			strscpy(id.name, control->name, sizeof(id.name));
 		id.numid = 0;
 		id.iface = control->iface;
 		id.device = control->device;
diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c
index a243d60f0..0f9fdc077 100644
--- a/drivers/staging/greybus/audio_module.c
+++ b/drivers/staging/greybus/audio_module.c
@@ -342,7 +342,7 @@ static int gb_audio_probe(struct gb_bundle *bundle,
 	/* inform above layer for uevent */
 	dev_dbg(dev, "Inform set_event:%d to above layer\n", 1);
 	/* prepare for the audio manager */
-	strlcpy(desc.name, gbmodule->name, GB_AUDIO_MANAGER_MODULE_NAME_LEN);
+	strscpy(desc.name, gbmodule->name, GB_AUDIO_MANAGER_MODULE_NAME_LEN);
 	desc.vid = 2; /* todo */
 	desc.pid = 3; /* todo */
 	desc.intf_id = gbmodule->dev_id;
diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c
index 662e3e8b4..e816e4db5 100644
--- a/drivers/staging/greybus/audio_topology.c
+++ b/drivers/staging/greybus/audio_topology.c
@@ -200,7 +200,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
 			return -EINVAL;
 		name = gbaudio_map_controlid(module, data->ctl_id,
 					     uinfo->value.enumerated.item);
-		strlcpy(uinfo->value.enumerated.name, name, NAME_SIZE);
+		strscpy(uinfo->value.enumerated.name, name, NAME_SIZE);
 		break;
 	default:
 		dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n",
@@ -1047,7 +1047,7 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module,
 	}
 
 	/* Prefix dev_id to widget control_name */
-	strlcpy(temp_name, w->name, NAME_SIZE);
+	strscpy(temp_name, w->name, NAME_SIZE);
 	snprintf(w->name, NAME_SIZE, "GB %d %s", module->dev_id, temp_name);
 
 	switch (w->type) {
@@ -1169,7 +1169,7 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module,
 		}
 		control->id = curr->id;
 		/* Prefix dev_id to widget_name */
-		strlcpy(temp_name, curr->name, NAME_SIZE);
+		strscpy(temp_name, curr->name, NAME_SIZE);
 		snprintf(curr->name, NAME_SIZE, "GB %d %s", module->dev_id,
 			 temp_name);
 		control->name = curr->name;
diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c
index ec96f2888..75cb170e0 100644
--- a/drivers/staging/greybus/power_supply.c
+++ b/drivers/staging/greybus/power_supply.c
@@ -449,7 +449,7 @@ static int __gb_power_supply_set_name(char *init_name, char *name, size_t len)
 
 	if (!strlen(init_name))
 		init_name = "gb_power_supply";
-	strlcpy(name, init_name, len);
+	strscpy(name, init_name, len);
 
 	while ((ret < len) && (psy = power_supply_get_by_name(name))) {
 		power_supply_put(psy);
diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c
index fc27c52de..672d540d3 100644
--- a/drivers/staging/greybus/spilib.c
+++ b/drivers/staging/greybus/spilib.c
@@ -455,10 +455,10 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)
 	dev_type = response.device_type;
 
 	if (dev_type == GB_SPI_SPI_DEV)
-		strlcpy(spi_board.modalias, "spidev",
+		strscpy(spi_board.modalias, "spidev",
 			sizeof(spi_board.modalias));
 	else if (dev_type == GB_SPI_SPI_NOR)
-		strlcpy(spi_board.modalias, "spi-nor",
+		strscpy(spi_board.modalias, "spi-nor",
 			sizeof(spi_board.modalias));
 	else if (dev_type == GB_SPI_SPI_MODALIAS)
 		memcpy(spi_board.modalias, response.name,
-- 
2.29.2


  parent reply	other threads:[~2021-01-31 20:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 17:28 [PATCH 00/13] Convert all users of strlcpy to strscpy Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 01/13] staging: comedi: Switch from " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` Kumar Kartikeya Dwivedi [this message]
2021-02-16 14:54   ` [PATCH 02/13] staging: greybus: " Alex Elder
2021-02-16 15:48     ` Kumar Kartikeya Dwivedi
2021-02-16 15:49       ` Alex Elder
2021-01-31 17:28 ` [PATCH 03/13] staging: fsl-dpaa2: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 04/13] staging: most: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 05/13] staging: nvec: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 06/13] staging: octeon: " Kumar Kartikeya Dwivedi
2021-02-16 14:36   ` Robert Richter
2021-01-31 17:28 ` [PATCH 07/13] staging: olpc_dcon: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 08/13] staging: rtl8188eu: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 09/13] staging: rtl8192e: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 10/13] staging: rtl8192u: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 11/13] staging: rtl8712: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 12/13] staging: sm750fb: " Kumar Kartikeya Dwivedi
2021-01-31 17:28 ` [PATCH 13/13] staging: wimax: " Kumar Kartikeya Dwivedi

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=20210131172838.146706-3-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=abbotti@mev.co.uk \
    --cc=ac100@lists.launchpad.net \
    --cc=akpm@linux-foundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=dsd@laptop.org \
    --cc=elder@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=hsweeten@visionengravers.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=jfrederich@gmail.com \
    --cc=johan@kernel.org \
    --cc=jon.nettleton@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=marvin24@gmx.de \
    --cc=mgreer@animalcreek.com \
    --cc=rmfrfs@gmail.com \
    --cc=rppt@kernel.org \
    --cc=rric@kernel.org \
    --cc=ruxandra.radulescu@nxp.com \
    --cc=sfr@canb.auug.org.au \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=teddy.wang@siliconmotion.com \
    --cc=tglx@linutronix.de \
    --cc=vaibhav.sr@gmail.com \
    --cc=vireshk@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wcohen@redhat.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;
as well as URLs for NNTP newsgroup(s).