]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
netem: swap transposed calloc args
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 7 Oct 2024 16:37:24 +0000 (09:37 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 7 Oct 2024 16:37:24 +0000 (09:37 -0700)
Gcc with -Wextra complains about transposed args to calloc
in netem.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/q_netem.c

index 90b26136e20e3ef856d197a5f61c8c6f16050b6a..c48fde1141466a8c7686e0aa180859b867bc4559 100644 (file)
@@ -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);