From: Matteo Croce Date: Sat, 8 Mar 2025 16:39:09 +0000 (+0100) Subject: network: remove useless loop (#36648) X-Git-Tag: v258-rc1~1141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd0d22c2a5bdbf427c68eab630dc06f55dc96c72;p=thirdparty%2Fsystemd.git network: remove useless loop (#36648) In route_metric_can_update() the loop iterates over the metrics, but skips all indices except for RTAX_MTU. Replace it with a simple compare. --- diff --git a/src/network/networkd-route-metric.c b/src/network/networkd-route-metric.c index 409e403ff14..480707fc2ae 100644 --- a/src/network/networkd-route-metric.c +++ b/src/network/networkd-route-metric.c @@ -75,12 +75,8 @@ bool route_metric_can_update(const RouteMetric *a, const RouteMetric *b, bool ex if (a->n_metrics != b->n_metrics) return false; - for (size_t i = 1; i < a->n_metrics; i++) { - if (i != RTAX_MTU) - continue; - if (a->metrics[i] != b->metrics[i]) - return false; - } + if (a->n_metrics > RTAX_MTU && a->metrics[RTAX_MTU] != b->metrics[RTAX_MTU]) + return false; return streq_ptr(a->tcp_congestion_control_algo, b->tcp_congestion_control_algo); }