* [PATCH] staging: lustre: lnet: prefer kcalloc over kzalloc with multiply
@ 2018-01-20 7:56 Sumit Pundir
0 siblings, 0 replies; only message in thread
From: Sumit Pundir @ 2018-01-20 7:56 UTC (permalink / raw)
To: oleg.drokin
Cc: andreas.dilger, jsimmons, gregkh, lustre-devel, devel, linux-kernel
Use kcalloc for allocating an array instead of kzalloc with
multiply. kcalloc is the preferred API. Issue reported by
checkpatch.pl
Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
---
drivers/staging/lustre/lnet/lnet/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c
index 1516ac6..0aea268 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -1146,7 +1146,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
if (nif <= 0)
return nif;
- ipaddrs = kzalloc(nif * sizeof(*ipaddrs), GFP_KERNEL);
+ ipaddrs = kcalloc(nif, sizeof(*ipaddrs), GFP_KERNEL);
if (!ipaddrs) {
CERROR("Can't allocate ipaddrs[%d]\n", nif);
lnet_ipif_free_enumeration(ifnames, nif);
@@ -1179,7 +1179,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
*ipaddrsp = ipaddrs;
} else {
if (nip > 0) {
- ipaddrs2 = kzalloc(nip * sizeof(*ipaddrs2),
+ ipaddrs2 = kcalloc(nip, sizeof(*ipaddrs2),
GFP_KERNEL);
if (!ipaddrs2) {
CERROR("Can't allocate ipaddrs[%d]\n", nip);
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-01-20 7:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-20 7:56 [PATCH] staging: lustre: lnet: prefer kcalloc over kzalloc with multiply Sumit Pundir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).