[PATCH 2/2] net/nfp: fix calloc parameters
Ferruh Yigit
ferruh.yigit at amd.com
Thu Nov 2 14:08:47 CET 2023
gcc [1] generates warning [2] about calloc usage, because calloc
parameter order is wrong, fixing it by replacing parameters.
[1]
gcc (GCC) 14.0.0 20231102 (experimental)
[2]
Compiling C object .../net_nfp_nfpcore_nfp_mutex.c.o
.../net/nfp/nfpcore/nfp_mutex.c: In function ‘nfp_cpp_mutex_alloc’:
../drivers/net/nfp/nfpcore/nfp_mutex.c:171:15:
warning: allocation of insufficient size ‘1’ for type
‘struct nfp_cpp_mutex’ with size ‘48’ [-Walloc-size]
171 | mutex = calloc(sizeof(*mutex), 1);
| ^
Fixes: c7e9729da6b5 ("net/nfp: support CPP")
Cc: stable at dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
Cc: alejandro.lucero at netronome.com
---
drivers/net/nfp/nfpcore/nfp_mutex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c
index 3c10c7a090c0..edb78dfdc917 100644
--- a/drivers/net/nfp/nfpcore/nfp_mutex.c
+++ b/drivers/net/nfp/nfpcore/nfp_mutex.c
@@ -168,7 +168,7 @@ nfp_cpp_mutex_alloc(struct nfp_cpp *cpp,
if (tmp != key)
return NULL;
- mutex = calloc(sizeof(*mutex), 1);
+ mutex = calloc(1, sizeof(*mutex));
if (mutex == NULL)
return NULL;
--
2.34.1
More information about the stable
mailing list