All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Amirhossein Hajimohammadi <info@hajimohammadi.net>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] staging: rtl8723bs: stop overreading monitor interface name
Date: Tue, 29 Sep 2026 18:05:12 +0200	[thread overview]
Message-ID: <2026092915-luxury-shush-6b29@gregkh> (raw)
In-Reply-To: <3B4B0B72-4DCE-4E40-9E87-732DCBAA4EAF@hajimohammadi.net>

On Tue, Sep 29, 2026 at 07:18:11PM +0330, Amirhossein Hajimohammadi wrote:
> From: AmirHossein HajiMohammadi <info@hajimohammadi.net>
> 
> cfg80211 passes a NUL-terminated interface name. memcpy() always reads
> IFNAMSIZ + 1 bytes, even when the caller supplied a shorter string.
> 
> Use strscpy() to stop at the terminator and bound the write to the
> destination buffer.
> 
> Signed-off-by: AmirHossein HajiMohammadi <info@hajimohammadi.net>
> ---
> Changes in v3:
> - Add an explicit From header matching the Signed-off-by identity.
> 
> Changes in v2:
> - Send the patch inline instead of as a MIME attachment.
> 
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 4416d0ec1..8f5032844 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -2158,7 +2158,7 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str
>  		goto out;
>  
>  	*ndev = pwdev_priv->pmon_ndev = mon_ndev;
> -	memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ + 1);
> +	strscpy(pwdev_priv->ifname_mon, name);

But we are replacing str*() calls in the kernel with memcpy() calls
where it can happen, so why go backwards here?

What caused you to notice this change is needed?  Have you measured a
speed up in throughput with this change applied?  How was it tested?

thanks,

greg k-h

  reply	other threads:[~2026-09-29 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 15:48 [PATCH v3] staging: rtl8723bs: stop overreading monitor interface name Amirhossein Hajimohammadi
2026-09-29 16:05 ` Greg KH [this message]
2026-09-29 17:28   ` Amirhossein Hajimohammadi
2026-10-01  9:59   ` Dan Carpenter
2026-10-01 17:47     ` Dan Carpenter

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=2026092915-luxury-shush-6b29@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=info@hajimohammadi.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.