mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: samsung: Use snprintf() to construct pin bank names
@ 2026-09-27 19:07 Mariia Nikitash
  2026-09-28 21:43 ` Justin Stitt
  0 siblings, 1 reply; 4+ messages in thread
From: Mariia Nikitash @ 2026-09-27 19:07 UTC (permalink / raw)
  To: krzk, s.nawrocki, peter.griffin, linusw
  Cc: alim.akhtar, linux-arm-kernel, linux-samsung-soc, linux-gpio,
	linux-kernel, linux-hardening, morbo, kees, justinstitt,
	aleksandr.loktionov, codemender-patching+linux, Mariia Nikitash

From: Bill Wendling <morbo@google.com>

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).

Link: https://github.com/KSPP/linux/issues/370 [1]
Cc: codemender-patching+linux@google.com
Assisted-by: LLM
Signed-off-by: Bill Wendling <morbo@google.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 5ecc9ed4c44d..0d639eec689c 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -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);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: samsung: Use snprintf() to construct pin bank names
  2026-09-27 19:07 [PATCH] pinctrl: samsung: Use snprintf() to construct pin bank names Mariia Nikitash
@ 2026-09-28 21:43 ` Justin Stitt
  2026-09-28 22:00   ` Bill Wendling
  0 siblings, 1 reply; 4+ messages in thread
From: Justin Stitt @ 2026-09-28 21:43 UTC (permalink / raw)
  To: Mariia Nikitash
  Cc: krzk, s.nawrocki, peter.griffin, linusw, alim.akhtar,
	linux-arm-kernel, linux-samsung-soc, linux-gpio, linux-kernel,
	linux-hardening, morbo, kees, aleksandr.loktionov,
	codemender-patching+linux

Hi,

On Sun, Sep 27, 2026 at 12:07:58PM -0700, Mariia Nikitash wrote:
> From: Bill Wendling <morbo@google.com>
> 
> 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).
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Cc: codemender-patching+linux@google.com
> Assisted-by: LLM
> Signed-off-by: Bill Wendling <morbo@google.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>

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 :)

> ---
>  drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index 5ecc9ed4c44d..0d639eec689c 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -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);
> -- 
> 2.43.0
> 
>

[1]: https://lore.kernel.org/all/20260915081910.4142719-17-morbo@google.com/

Thanks
Justin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: samsung: Use snprintf() to construct pin bank names
  2026-09-28 21:43 ` Justin Stitt
@ 2026-09-28 22:00   ` Bill Wendling
  2026-09-28 22:07     ` Justin Stitt
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Wendling @ 2026-09-28 22:00 UTC (permalink / raw)
  To: Justin Stitt
  Cc: Mariia Nikitash, krzk, s.nawrocki, peter.griffin, linusw,
	alim.akhtar, linux-arm-kernel, linux-samsung-soc, linux-gpio,
	linux-kernel, linux-hardening, kees, aleksandr.loktionov,
	codemender-patching+linux

On Mon, Sep 28, 2026 at 2:43 PM Justin Stitt <justinstitt@google.com> wrote:
>
> Hi,
>
> On Sun, Sep 27, 2026 at 12:07:58PM -0700, Mariia Nikitash wrote:
> > From: Bill Wendling <morbo@google.com>
> >
> > 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).
> >
> > Link: https://github.com/KSPP/linux/issues/370 [1]
> > Cc: codemender-patching+linux@google.com
> > Assisted-by: LLM
> > Signed-off-by: Bill Wendling <morbo@google.com>
> > Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> > Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
>
> 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

> > ---
> >  drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> > index 5ecc9ed4c44d..0d639eec689c 100644
> > --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> > +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> > @@ -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);
> > --
> > 2.43.0
> >
> >
>
> [1]: https://lore.kernel.org/all/20260915081910.4142719-17-morbo@google.com/
>
> Thanks
> Justin

On Mon, Sep 28, 2026 at 2:43 PM Justin Stitt <justinstitt@google.com> wrote:
>
> Hi,
>
> On Sun, Sep 27, 2026 at 12:07:58PM -0700, Mariia Nikitash wrote:
> > From: Bill Wendling <morbo@google.com>
> >
> > 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).
> >
> > Link: https://github.com/KSPP/linux/issues/370 [1]
> > Cc: codemender-patching+linux@google.com
> > Assisted-by: LLM
> > Signed-off-by: Bill Wendling <morbo@google.com>
> > Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> > Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
>
> 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 :)
>
> > ---
> >  drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> > index 5ecc9ed4c44d..0d639eec689c 100644
> > --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> > +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> > @@ -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);
> > --
> > 2.43.0
> >
> >
>
> [1]: https://lore.kernel.org/all/20260915081910.4142719-17-morbo@google.com/
>
> Thanks
> Justin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: samsung: Use snprintf() to construct pin bank names
  2026-09-28 22:00   ` Bill Wendling
@ 2026-09-28 22:07     ` Justin Stitt
  0 siblings, 0 replies; 4+ messages in thread
From: Justin Stitt @ 2026-09-28 22:07 UTC (permalink / raw)
  To: Bill Wendling
  Cc: Mariia Nikitash, krzk, s.nawrocki, peter.griffin, linusw,
	alim.akhtar, linux-arm-kernel, linux-samsung-soc, linux-gpio,
	linux-kernel, linux-hardening, kees, aleksandr.loktionov,
	codemender-patching+linux

Hi,

On Mon, Sep 28, 2026 at 3:01 PM Bill Wendling <morbo@google.com> wrote:
> 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

>
> -bw
>

Thanks
Justin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-28 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 19:07 [PATCH] pinctrl: samsung: Use snprintf() to construct pin bank names Mariia Nikitash
2026-09-28 21:43 ` Justin Stitt
2026-09-28 22:00   ` Bill Wendling
2026-09-28 22:07     ` Justin Stitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®