From: Zbigniew Jędrzejewski-Szmek Date: Thu, 7 Apr 2016 18:29:07 +0000 (-0400) Subject: lldp: replace if with assert_cc X-Git-Tag: v230~199^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2985%2Fhead;p=thirdparty%2Fsystemd.git lldp: replace if with assert_cc LLDP_TX_HOLD or one of the other variables might be changed in the future resulting in a silent error here if the if was just removed. Replacement for #2983. --- diff --git a/src/network/networkd-lldp-tx.c b/src/network/networkd-lldp-tx.c index 5af2a31ea7b..c940e630526 100644 --- a/src/network/networkd-lldp-tx.c +++ b/src/network/networkd-lldp-tx.c @@ -239,9 +239,8 @@ static int link_send_lldp(Link *link) { (void) gethostname_strict(&hostname); (void) parse_env_file("/etc/machine-info", NEWLINE, "PRETTY_HOSTNAME", &pretty_hostname, NULL); + assert_cc(LLDP_TX_INTERVAL_USEC * LLDP_TX_HOLD + 1 <= (UINT16_MAX - 1) * USEC_PER_SEC); ttl = DIV_ROUND_UP(LLDP_TX_INTERVAL_USEC * LLDP_TX_HOLD + 1, USEC_PER_SEC); - if (ttl > (usec_t) UINT16_MAX) - ttl = (usec_t) UINT16_MAX; caps = (link->network && link->network->ip_forward != ADDRESS_FAMILY_NO) ? SD_LLDP_SYSTEM_CAPABILITIES_ROUTER :