mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Cc: arend.vanspriel@broadcom.com, linux-wireless@vger.kernel.org,
	brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com,
	linux-kernel@vger.kernel.org, morbo@google.com, kees@kernel.org,
	justinstitt@google.com, codemender-patching+linux@google.com
Subject: Re: [PATCH] wifi: brcmfmac: Replace strlcat() with snprintf() in brcmf_fw_alloc_request()
Date: Tue, 17 Nov 2026 14:31:50 +0100	[thread overview]
Message-ID: <20261117133150.817227-1-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <20261014005553.71803-1-nikitash.mariiaw@gmail.com>

On Tue, 13 Oct 2026 17:55:52 -0700, Mariia Nikitash <nikitash.mariiaw@gmail.com> wrote:
> From: Bill Wendling <morbo@google.com>
>
> brcmf_fw_alloc_request() constructs firmware file paths by chaining
> strscpy() and multiple strlcat() calls for the module parameter path,
> separator, base name, and extension.
>
> In preparation for removing the deprecated strlcat() API[1], format the
> complete firmware path in a single snprintf() call.
>
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Cc: codemender-patching+linux@google.com
> Assisted-by: LLM

Is this Cc: line necessary? Can you clarify its purpose? No need to clarify
in the commit message. Just an email response will do.

The Assisted-by: tag shows this change was produced with an LLM. Please
follow the guidelines in Documentation/process/generated-content.rst so
it is clear what was tool generated and what tool and/or LLM was used.

[...]

>  	for (j = 0; j < n_fwnames; j++) {
> -		fwreq->items[j].path = fwnames[j].path;
> -		fwnames[j].path[0] = '\0';
>  		/* check if firmware path is provided by module parameter */
>  		if (brcmf_mp_global.firmware_path[0] != '\0') {
> -			strscpy(fwnames[j].path, mp_path,
> -				BRCMF_FW_NAME_LEN);
> -
> -			if (end != '/') {
> -				strlcat(fwnames[j].path, "/",
> -					BRCMF_FW_NAME_LEN);
> -			}
> +			snprintf(fwnames[j].path, BRCMF_FW_NAME_LEN, "%s%s%s%s",
> +				 mp_path, (end == '/') ? "" : "/",
> +				 mapping_table[i].fw_base,
> +				 fwnames[j].extension);
> +		} else {
> +			snprintf(fwnames[j].path, BRCMF_FW_NAME_LEN, "%s%s",
> +				 mapping_table[i].fw_base,
> +				 fwnames[j].extension);
>  		}
> -		strlcat(fwnames[j].path, mapping_table[i].fw_base,
> -			BRCMF_FW_NAME_LEN);
> -		strlcat(fwnames[j].path, fwnames[j].extension,
> -			BRCMF_FW_NAME_LEN);
>  		fwreq->items[j].path = fwnames[j].path;
>  	}

Please address Kees' comment and collapse this into a single snprintf().
Note mp_path points to the firmware_path array so it can never be NULL; an
empty mp_path simply prints nothing, so something like the following would do:

	snprintf(fwnames[j].path, BRCMF_FW_NAME_LEN, "%s%s%s%s", mp_path,
		 (mp_path_len && end != '/') ? "/" : "",
		 mapping_table[i].fw_base, fwnames[j].extension);

Regards,
Arend

  parent reply	other threads:[~2026-11-17 13:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  0:55 Mariia Nikitash
2026-11-12 18:36 ` Kees Cook
2026-11-17 13:31 ` Arend van Spriel [this message]
2026-11-18  2:32   ` Ping-Ke Shih

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=20261117133150.817227-1-arend.vanspriel@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211@lists.linux.dev \
    --cc=codemender-patching+linux@google.com \
    --cc=justinstitt@google.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=morbo@google.com \
    --cc=nikitash.mariiaw@gmail.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

all inboxes | Powered by JetHome®