Skip to contentSkip to conversation

staging: rtl8712: use kmalloc_array

PATCH Superseded Tudor Gheorghiu 2 participants 2 messages Sep 22, 2024 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: use kmalloc_array

use kmalloc_array instead of kmalloc with multiply

---
 drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
index 408616e9afcf..a0f29fab3dce 100644
@@ -117,7 +117,7 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
 	/*init xmit_buf*/
 	_init_queue(&pxmitpriv->free_xmitbuf_queue);
 	_init_queue(&pxmitpriv->pending_xmitbuf_queue);
-	pxmitpriv->pxmitbuf = kmalloc(NR_XMITBUFF * sizeof(struct xmit_buf), GFP_ATOMIC);
+	pxmitpriv->pxmitbuf = kmalloc_array(NR_XMITBUFF, sizeof(struct xmit_buf), GFP_ATOMIC);
 	if (!pxmitpriv->pxmitbuf)
 		goto clean_up_frame_buf;
 	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 12 lines · Tudor Gheorghiu

use kmalloc_array instead of kmalloc with multiply

---
  drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_xmit.c +0 -0
index 408616e9afcf..a0f29fab3dce 100644

drivers/staging/rtl8712/rtl871x_xmit.c int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv, · line 123

Quoted 8 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
@@ -117,7 +117,7 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
  	/*init xmit_buf*/
  	_init_queue(&pxmitpriv->free_xmitbuf_queue);
  	_init_queue(&pxmitpriv->pending_xmitbuf_queue);
-	pxmitpriv->pxmitbuf = kmalloc(NR_XMITBUFF * sizeof(struct xmit_buf), GFP_ATOMIC);
+	pxmitpriv->pxmitbuf = kmalloc_array(NR_XMITBUFF, sizeof(struct xmit_buf), GFP_ATOMIC);
  	if (!pxmitpriv->pxmitbuf)
  		goto clean_up_frame_buf;
  	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;

Hi Tudor,

please improve your patch description. Better omit what you are changing as this can be seen in the change itself. Do focus on why this patch makes the code better. Please use a full sentence starting with an upper letter and ends with a ".".

If you send in a second version of this patch please use a change history. Description from Dan under:
https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

Thanks for your support.

Bye Philipp