diff mbox series

[iproute] netem: swap transposed calloc args

Message ID 20241007163812.499944-1-stephen@networkplumber.org (mailing list archive)
State Accepted
Commit 95f4021b4865a934a99f692b75ffa6d16fae241b
Delegated to: Stephen Hemminger
Headers show
Series [iproute] netem: swap transposed calloc args | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger Oct. 7, 2024, 4:38 p.m. UTC
Gcc with -Wextra complains about transposed args to calloc
in netem.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 tc/q_netem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 8, 2024, 4:20 p.m. UTC | #1
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Mon,  7 Oct 2024 09:38:04 -0700 you wrote:
> Gcc with -Wextra complains about transposed args to calloc
> in netem.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  tc/q_netem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [iproute] netem: swap transposed calloc args
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=95f4021b4865

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tc/q_netem.c b/tc/q_netem.c
index 90b26136..c48fde11 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -414,7 +414,7 @@  random_loss_model:
 			}
 		} else if (matches(*argv, "distribution") == 0) {
 			NEXT_ARG();
-			dist_data = calloc(sizeof(dist_data[0]), MAX_DIST);
+			dist_data = calloc(MAX_DIST, sizeof(dist_data[0]));
 			if (dist_data == NULL)
 				return -1;
 
@@ -479,7 +479,7 @@  random_loss_model:
 				if (strcmp(*argv, "distribution") == 0) {
 					present[TCA_NETEM_SLOT] = 1;
 					NEXT_ARG();
-					slot_dist_data = calloc(sizeof(slot_dist_data[0]), MAX_DIST);
+					slot_dist_data = calloc(MAX_DIST, sizeof(slot_dist_data[0]));
 					if (!slot_dist_data)
 						return -1;
 					slot_dist_size = get_distribution(*argv, slot_dist_data, MAX_DIST);