All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: Use pointer type in vzalloc()
@ 2026-07-22 13:18 Patryk Gawroński
  2026-07-28  7:35 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Patryk Gawroński @ 2026-07-22 13:18 UTC (permalink / raw)
  To: gregkh
  Cc: Patryk Gawroński, Nikolay Kulikov, Hans de Goede,
	Michael Straube, William Hansen-Baird, Gianmaria Biselli,
	Eugene Mavick, Artur Stupa, Yan Pan, Diksha Kumari, linux-staging,
	linux-kernel

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);
 
 	if (!pstapriv->pallocated_stainfo_buf)
 		return _FAIL;
-- 
2.55.0


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 13:18 [PATCH] staging: rtl8723bs: Use pointer type in vzalloc() Patryk Gawroński
2026-07-28  7:35 ` Greg KH

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.