Skip to contentSkip to conversation

pinctrl: samsung: Use snprintf() to construct pin bank names

PATCH Applied Mariia Nikitash 4 participants 5 messages Sep 27 – Nov 9

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: samsung: Use snprintf() to construct pin bank names

From: Bill Wendling <[email protected]>

samsung_banks_node_get() constructs each pin bank node name by copying bank->name with strscpy() and appending the suffix with strlcat().

In preparation for removing the deprecated strlcat() API[1], format the node name in a single snprintf() call, which preserves the existing truncation check against sizeof(node_name).

---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -2
index 5ecc9ed4c44d..0d639eec689c 100644
@@ -1155,8 +1155,7 @@ static void samsung_banks_node_get(struct device *dev, struct samsung_pinctrl_dr
 
 	bank = d->pin_banks;
 	for (i = 0; i < d->nr_banks; ++i, ++bank) {
-		strscpy(node_name, bank->name, sizeof(node_name));
-		len = strlcat(node_name, suffix, sizeof(node_name));
+		len = snprintf(node_name, sizeof(node_name), "%s%s", bank->name, suffix);
 		if (len >= sizeof(node_name)) {
 			dev_err(dev, "Too long pin bank name '%s', ignoring\n",
 				bank->name);
Signature · 1 line
2.43.0
#1 lore raw

Hi,

Quoted 9 lines · Mariia Nikitash

From: Bill Wendling <[email protected]>

samsung_banks_node_get() constructs each pin bank node name by copying bank->name with strscpy() and appending the suffix with strlcat().

In preparation for removing the deprecated strlcat() API[1], format the node name in a single snprintf() call, which preserves the existing truncation check against sizeof(node_name).

Quoted 6 lines

Are you forwarding this patch on behalf of Bill? I see Bill as the author of the commit and I recall seeing this in some series he sent earlier [1] and this patch you've sent doesn't seem to be a v2.

Let me know what your role is on this patch and why it has been separated out from Bill's series.

It is entirely possible that I am lacking context. Please fill me in :)

Quoted 22 lines
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -2
index 5ecc9ed4c44d..0d639eec689c 100644
@@ -1155,8 +1155,7 @@ static void samsung_banks_node_get(struct device *dev, struct samsung_pinctrl_dr
 
 	bank = d->pin_banks;
 	for (i = 0; i < d->nr_banks; ++i, ++bank) {
-		strscpy(node_name, bank->name, sizeof(node_name));
-		len = strlcat(node_name, suffix, sizeof(node_name));
+		len = snprintf(node_name, sizeof(node_name), "%s%s", bank->name, suffix);
 		if (len >= sizeof(node_name)) {
 			dev_err(dev, "Too long pin bank name '%s', ignoring\n",
 				bank->name);
Signature · 1 line
2.43.0

[1]: https://lore.kernel.org/all/[email protected]/

Thanks
Justin

#2 lore raw
Quoted 20 lines · Justin Stitt

Hi,

Quoted 9 lines · Mariia Nikitash

From: Bill Wendling <[email protected]>

samsung_banks_node_get() constructs each pin bank node name by copying bank->name with strscpy() and appending the suffix with strlcat().

In preparation for removing the deprecated strlcat() API[1], format the node name in a single snprintf() call, which preserves the existing truncation check against sizeof(node_name).

Quoted 6 lines
Quoted 9 lines

Are you forwarding this patch on behalf of Bill? I see Bill as the author of the commit and I recall seeing this in some series he sent earlier [1] and this patch you've sent doesn't seem to be a v2.

Let me know what your role is on this patch and why it has been separated out from Bill's series.

It is entirely possible that I am lacking context. Please fill me in :)

She's been marsheling some of the strlcat patches I sent to the mailing list. It's possible I sent a "v2" of all patches, whether there were changes in them or not.

The patch series needs to be separated a bit because of Kees's 'seq_buf' changes, which will make some of the patches I sent obsolete.

-bw

Quoted 27 lines
Quoted 19 lines
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -3
index 5ecc9ed4c44d..0d639eec689c 100644
@@ -1155,8 +1155,7 @@ static void samsung_banks_node_get(struct device *dev, struct samsung_pinctrl_dr
 
      bank = d->pin_banks;
      for (i = 0; i < d->nr_banks; ++i, ++bank) {
-             strscpy(node_name, bank->name, sizeof(node_name));
-             len = strlcat(node_name, suffix, sizeof(node_name));
+             len = snprintf(node_name, sizeof(node_name), "%s%s", bank->name, suffix);
              if (len >= sizeof(node_name)) {
                      dev_err(dev, "Too long pin bank name '%s', ignoring\n",
                              bank->name);
--
Quoted 3 lines

2.43.0

[1]: https://lore.kernel.org/all/[email protected]/

Thanks
Justin

Quoted 56 lines · Justin Stitt

Hi,

Quoted 9 lines · Mariia Nikitash

From: Bill Wendling <[email protected]>

samsung_banks_node_get() constructs each pin bank node name by copying bank->name with strscpy() and appending the suffix with strlcat().

In preparation for removing the deprecated strlcat() API[1], format the node name in a single snprintf() call, which preserves the existing truncation check against sizeof(node_name).

Quoted 6 lines

Are you forwarding this patch on behalf of Bill? I see Bill as the author of the commit and I recall seeing this in some series he sent earlier [1] and this patch you've sent doesn't seem to be a v2.

Let me know what your role is on this patch and why it has been separated out from Bill's series.

It is entirely possible that I am lacking context. Please fill me in :)

Quoted 19 lines
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -3
index 5ecc9ed4c44d..0d639eec689c 100644
@@ -1155,8 +1155,7 @@ static void samsung_banks_node_get(struct device *dev, struct samsung_pinctrl_dr
 
      bank = d->pin_banks;
      for (i = 0; i < d->nr_banks; ++i, ++bank) {
-             strscpy(node_name, bank->name, sizeof(node_name));
-             len = strlcat(node_name, suffix, sizeof(node_name));
+             len = snprintf(node_name, sizeof(node_name), "%s%s", bank->name, suffix);
              if (len >= sizeof(node_name)) {
                      dev_err(dev, "Too long pin bank name '%s', ignoring\n",
                              bank->name);
--
Quoted 3 lines

2.43.0

[1]: https://lore.kernel.org/all/[email protected]/

Thanks
Justin

#3 lore raw

Hi,

Quoted 7 lines · Bill Wendling

She's been marsheling some of the strlcat patches I sent to the mailing list. It's possible I sent a "v2" of all patches, whether there were changes in them or not.

The patch series needs to be separated a bit because of Kees's 'seq_buf' changes, which will make some of the patches I sent obsolete.

ACK

Quoted 3 lines

-bw

Thanks
Justin

maintainer Applied
#4 lore raw
In reply to Mariia Nikitash
Quoted 8 lines · Mariia Nikitash

samsung_banks_node_get() constructs each pin bank node name by copying bank->name with strscpy() and appending the suffix with strlcat().

In preparation for removing the deprecated strlcat() API[1], format the node name in a single snprintf() call, which preserves the existing truncation check against sizeof(node_name).

[...]

Applied, thanks!

[1/1] pinctrl: samsung: Use snprintf() to construct pin bank names

      https://git.kernel.org/pinctrl/samsung/c/a47853cef90c0553457e690df693a6cc806a3849

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>