Linux kernel staging patches
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Patryk Gawroński" <gawronski1.6@gmail.com>
Cc: Nikolay Kulikov <nikolayof23@gmail.com>,
	Hans de Goede <hansg@kernel.org>,
	Michael Straube <straube.linux@gmail.com>,
	William Hansen-Baird <william.hansen.baird@gmail.com>,
	Gianmaria Biselli <gianmariabiselli@gmail.com>,
	Eugene Mavick <mavick4022@gmail.com>,
	Artur Stupa <arthur.stupa@gmail.com>,
	Yan Pan <maxwell2119@163.com>,
	Diksha Kumari <dikshakdevgan@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: Use pointer type in vzalloc()
Date: Tue, 28 Jul 2026 09:35:49 +0200	[thread overview]
Message-ID: <2026072814-juggling-savage-cb0d@gregkh> (raw)
In-Reply-To: <20260722131827.46975-1-gawronski1.6@gmail.com>

On Wed, Jul 22, 2026 at 03:18:25PM +0200, Patryk Gawroński wrote:
> Update the memory allocation in _rtw_init_sta_priv() to use
> sizeof(*pstapriv->pallocated_stainfo_buf) instead of explicitly
> passing sizeof(struct sta_info).
> 
> This resolves the following checkpatch warning:
> "Prefer vzalloc(sizeof(*pstapriv->pallocated_stainfo_buf)...) over
> vzalloc(sizeof(struct sta_info)...)"
> 
> Using the pointer type is preferred in the kernel as it ensures the
> allocated size remains correct even if the pointer's underlying type
> changes in the future. The allocation was also split across multiple
> lines to comply with column length limits.
> 
> Signed-off-by: Patryk Gawroński <gawronski1.6@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
> index aea660f27959..0758d0540f4b 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
> @@ -54,7 +54,8 @@ u32 _rtw_init_sta_priv(struct	sta_priv *pstapriv)
>  	struct sta_info *psta;
>  	s32 i;
>  
> -	pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4);
> +	pstapriv->pallocated_stainfo_buf =
> +		vzalloc(sizeof(*pstapriv->pallocated_stainfo_buf) * NUM_STA + 4);

You just broke the driver as the math here is now not the same.

Hint, look at what pallocated_stainfo_buf really is.  It's not a pointer
to a struct at all, right?

thanks,

greg k-h

      reply	other threads:[~2026-07-28  7:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 13:18 [PATCH] staging: rtl8723bs: Use pointer type in vzalloc() Patryk Gawroński
2026-07-28  7:35 ` Greg KH [this message]

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=2026072814-juggling-savage-cb0d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=arthur.stupa@gmail.com \
    --cc=dikshakdevgan@gmail.com \
    --cc=gawronski1.6@gmail.com \
    --cc=gianmariabiselli@gmail.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mavick4022@gmail.com \
    --cc=maxwell2119@163.com \
    --cc=nikolayof23@gmail.com \
    --cc=straube.linux@gmail.com \
    --cc=william.hansen.baird@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