All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/1] ovpn: use kmalloc_array() for array space allocation
@ 2025-09-03 12:00 Gary Chu(楚光庆)
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Chu(楚光庆) @ 2025-09-03 12:00 UTC (permalink / raw)
  To: Markus.Elfring@web.de, netdev@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, andrew+netdev@lunn.ch,
	antonio@openvpn.net, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, sd@queasysnail.net,
	horms@kernel.org

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

Hi Markus,
	First of all, thank you for your reminder. According to your suggestion, the format "Chu Guangqing" should be used. However, in line with our company's signature conventions and my previous contributions to the kernel community, I have been using "chuguangqing". Therefore, I have to continue using this signature. The signature should not be changed frequently.

> 
> > Signed-off-by: chuguangqing <chuguangqing@inspur.com>
> 
> Would the personal name usually deviate a bit from the email identifier
> according to the Developer's Certificate of Origin?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Docume
> ntation/process/submitting-patches.rst?h=v6.17-rc4#n436
> 
> Regards,
> Markus

Best regards,
Chu Guangqing
<chuguangqing@inspur.com>

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3931 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH 1/1] ovpn: use kmalloc_array() for array space allocation
@ 2025-09-01 11:21 chuguangqing
  2025-09-02  9:00 ` PATCH v2 Re: " chuguangqing
  0 siblings, 1 reply; 5+ messages in thread
From: chuguangqing @ 2025-09-01 11:21 UTC (permalink / raw)
  To: Antonio Quartulli, Sabrina Dubroca, Andrew Lunn, davem,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, chuguangqing

Replace kmalloc(size * sizeof) with kmalloc_array() for safer memory
allocation and overflow prevention.

Signed-off-by: chuguangqing <chuguangqing@inspur.com>
---
 drivers/net/ovpn/crypto_aead.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ovpn/crypto_aead.c b/drivers/net/ovpn/crypto_aead.c
index 2cca759feffa..8274c3ae8d0b 100644
--- a/drivers/net/ovpn/crypto_aead.c
+++ b/drivers/net/ovpn/crypto_aead.c
@@ -72,8 +72,8 @@ int ovpn_aead_encrypt(struct ovpn_peer *peer, struct ovpn_crypto_key_slot *ks,
 		return -ENOSPC;
 
 	/* sg may be required by async crypto */
-	ovpn_skb_cb(skb)->sg = kmalloc(sizeof(*ovpn_skb_cb(skb)->sg) *
-				       (nfrags + 2), GFP_ATOMIC);
+	ovpn_skb_cb(skb)->sg = kmalloc_array((nfrags + 2), sizeof(*ovpn_skb_cb(skb)->sg),
+					     GFP_ATOMIC);
 	if (unlikely(!ovpn_skb_cb(skb)->sg))
 		return -ENOMEM;
 
@@ -185,8 +185,8 @@ int ovpn_aead_decrypt(struct ovpn_peer *peer, struct ovpn_crypto_key_slot *ks,
 		return -ENOSPC;
 
 	/* sg may be required by async crypto */
-	ovpn_skb_cb(skb)->sg = kmalloc(sizeof(*ovpn_skb_cb(skb)->sg) *
-				       (nfrags + 2), GFP_ATOMIC);
+	ovpn_skb_cb(skb)->sg = kmalloc_array((nfrags + 2), sizeof(*ovpn_skb_cb(skb)->sg),
+					     GFP_ATOMIC);
 	if (unlikely(!ovpn_skb_cb(skb)->sg))
 		return -ENOMEM;
 
-- 
2.43.5


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

end of thread, other threads:[~2025-09-03 12:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03 12:00 [PATCH v2 1/1] ovpn: use kmalloc_array() for array space allocation Gary Chu(楚光庆)
  -- strict thread matches above, loose matches on Subject: below --
2025-09-01 11:21 [PATCH " chuguangqing
2025-09-02  9:00 ` PATCH v2 Re: " chuguangqing
2025-09-02  9:00   ` [PATCH v2 " chuguangqing
2025-09-02 13:15     ` Markus Elfring
2025-09-03 12:17       ` chuguangqing
2025-09-03  8:41     ` Antonio Quartulli

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.