[v2,8/8] net/sfc: fix calloc parameters

Message ID 20240124185406.3598985-8-ferruh.yigit@amd.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/8] pipeline: fix calloc parameters |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Ferruh Yigit Jan. 24, 2024, 6:54 p.m. UTC
  gcc [1] generates warning [2] about rte_calloc usage, because
rte_calloc parameter order is wrong, fixing it by replacing parameters.

[1]
gcc (GCC) 14.0.1 20240124 (experimental)

[2]
Compiling C object drivers/libtmp_rte_net_sfc.a.p/net_sfc_sfc_mae.c.o
../net/sfc/sfc_mae.c: In function ‘sfc_mae_action_set_list_add’:
../drivers/net/sfc/sfc_mae.c:1353:35:
 warning: ‘rte_calloc’ sizes specified with ‘sizeof’ in the earlier
 argument and not in the later argument [-Wcalloc-transposed-args]
 1353 |                    sizeof(struct sfc_mae_action_set *),
      |                           ^~~~~~

Fixes: 002f591f54c3 ("net/sfc: support packet replay in transfer flows")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
Cc: ivan.malov@arknetworks.am
---
 drivers/net/sfc/sfc_mae.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Morten Brørup Jan. 24, 2024, 7:02 p.m. UTC | #1
> From: Ferruh Yigit [mailto:ferruh.yigit@amd.com]
> Sent: Wednesday, 24 January 2024 19.54
> 
> gcc [1] generates warning [2] about rte_calloc usage, because
> rte_calloc parameter order is wrong, fixing it by replacing parameters.
> 
> [1]
> gcc (GCC) 14.0.1 20240124 (experimental)
> 
> [2]
> Compiling C object drivers/libtmp_rte_net_sfc.a.p/net_sfc_sfc_mae.c.o
> ../net/sfc/sfc_mae.c: In function ‘sfc_mae_action_set_list_add’:
> ../drivers/net/sfc/sfc_mae.c:1353:35:
>  warning: ‘rte_calloc’ sizes specified with ‘sizeof’ in the earlier
>  argument and not in the later argument [-Wcalloc-transposed-args]
>  1353 |                    sizeof(struct sfc_mae_action_set *),
>       |                           ^~~~~~
> 
> Fixes: 002f591f54c3 ("net/sfc: support packet replay in transfer
> flows")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---

Acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Andrew Rybchenko Jan. 25, 2024, 7:10 a.m. UTC | #2
On 1/24/24 22:02, Morten Brørup wrote:
>> From: Ferruh Yigit [mailto:ferruh.yigit@amd.com]
>> Sent: Wednesday, 24 January 2024 19.54
>>
>> gcc [1] generates warning [2] about rte_calloc usage, because
>> rte_calloc parameter order is wrong, fixing it by replacing parameters.
>>
>> [1]
>> gcc (GCC) 14.0.1 20240124 (experimental)
>>
>> [2]
>> Compiling C object drivers/libtmp_rte_net_sfc.a.p/net_sfc_sfc_mae.c.o
>> ../net/sfc/sfc_mae.c: In function ‘sfc_mae_action_set_list_add’:
>> ../drivers/net/sfc/sfc_mae.c:1353:35:
>>   warning: ‘rte_calloc’ sizes specified with ‘sizeof’ in the earlier
>>   argument and not in the later argument [-Wcalloc-transposed-args]
>>   1353 |                    sizeof(struct sfc_mae_action_set *),
>>        |                           ^~~~~~
>>
>> Fixes: 002f591f54c3 ("net/sfc: support packet replay in transfer
>> flows")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
>> ---
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  

Patch

diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index e5ec0ae49d4d..60ff6d21810a 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1350,8 +1350,8 @@  sfc_mae_action_set_list_add(struct sfc_adapter *sa,
 
 	action_set_list->action_sets =
 		rte_calloc("sfc_mae_action_set_list_action_sets",
-			   sizeof(struct sfc_mae_action_set *),
-			   action_set_list->nb_action_sets, 0);
+			   action_set_list->nb_action_sets,
+			   sizeof(struct sfc_mae_action_set *), 0);
 	if (action_set_list->action_sets == NULL) {
 		sfc_err(sa, "failed to allocate action set list");
 		rte_free(action_set_list);