Skip to content

Commit ffd8149

Browse files
blucayuwata
authored andcommitted
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 c7c5672
1 parent b24c384 commit ffd8149

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/libsystemd-network/sd-radv.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ int sd_radv_set_home_agent_lifetime(sd_radv *ra, uint64_t lifetime_usec) {
614614

615615
int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
616616
sd_radv_prefix *found = NULL;
617-
int r;
618617

619618
assert_return(ra, -EINVAL);
620619
assert_return(p, -EINVAL);
@@ -626,11 +625,8 @@ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
626625
const char *addr_p = IN6_ADDR_PREFIX_TO_STRING(&p->opt.in6_addr, p->opt.prefixlen);
627626

628627
LIST_FOREACH(prefix, cur, ra->prefixes) {
629-
r = in6_addr_prefix_intersect(&cur->opt.in6_addr, cur->opt.prefixlen,
630-
&p->opt.in6_addr, p->opt.prefixlen);
631-
if (r < 0)
632-
return r;
633-
if (r == 0)
628+
if (!in6_addr_prefix_intersect(&cur->opt.in6_addr, cur->opt.prefixlen,
629+
&p->opt.in6_addr, p->opt.prefixlen))
634630
continue; /* no intersection */
635631

636632
if (cur->opt.prefixlen == p->opt.prefixlen) {

0 commit comments

Comments
 (0)