Linux NFS development
 help / color / mirror / Atom feed
* [PATCH 1/1] SUNRPC: use kmalloc_array() instead of kmalloc()
@ 2025-11-21  3:01 Gongwei Li
  2025-12-05 14:46 ` Chuck Lever
  0 siblings, 1 reply; 2+ messages in thread
From: Gongwei Li @ 2025-11-21  3:01 UTC (permalink / raw)
  To: trondmy, anna, chuck.lever, jlayton
  Cc: neil, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
	horms, linux, ligongwei, linux-nfs, netdev, linux-kernel

From: Gongwei Li <ligongwei@kylinos.cn>

Replace kmalloc() with kmalloc_array() to prevent potential
overflow, as recommended in Documentation/process/deprecated.rst.

Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
---
 net/sunrpc/auth_gss/gss_krb5_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 16dcf115de1e..9418b1715317 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -404,7 +404,7 @@ gss_krb5_cts_crypt(struct crypto_sync_skcipher *cipher, struct xdr_buf *buf,
 		WARN_ON(0);
 		return -ENOMEM;
 	}
-	data = kmalloc(GSS_KRB5_MAX_BLOCKSIZE * 2, GFP_KERNEL);
+	data = kmalloc_array(2, GSS_KRB5_MAX_BLOCKSIZE, GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-- 
2.25.1


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

end of thread, other threads:[~2025-12-05 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21  3:01 [PATCH 1/1] SUNRPC: use kmalloc_array() instead of kmalloc() Gongwei Li
2025-12-05 14:46 ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox