From: Luca Boccassi Date: Thu, 25 Apr 2024 15:18:08 +0000 (+0100) Subject: sd-radv: remove unnecessary check X-Git-Tag: v256-rc1~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ffd8149bc0d272023a5e65ccb21d322981fcce9c;p=thirdparty%2Fsystemd.git sd-radv: remove unnecessary check in6_addr_prefix_intersect() returns a bool, so the check < 0 is dead code. Flagged by codeql. Follow-up for c7c56724a5d7cc2b6b0d9d5f95b1055811014843 --- diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index b8c5d1fbfd1..c384d4e6275 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -614,7 +614,6 @@ int sd_radv_set_home_agent_lifetime(sd_radv *ra, uint64_t lifetime_usec) { int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) { sd_radv_prefix *found = NULL; - int r; assert_return(ra, -EINVAL); assert_return(p, -EINVAL); @@ -626,11 +625,8 @@ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) { const char *addr_p = IN6_ADDR_PREFIX_TO_STRING(&p->opt.in6_addr, p->opt.prefixlen); LIST_FOREACH(prefix, cur, ra->prefixes) { - r = in6_addr_prefix_intersect(&cur->opt.in6_addr, cur->opt.prefixlen, - &p->opt.in6_addr, p->opt.prefixlen); - if (r < 0) - return r; - if (r == 0) + if (!in6_addr_prefix_intersect(&cur->opt.in6_addr, cur->opt.prefixlen, + &p->opt.in6_addr, p->opt.prefixlen)) continue; /* no intersection */ if (cur->opt.prefixlen == p->opt.prefixlen) {