Skip to contentSkip to conversation

Two minor code fixes

PATCH In review Phil Sutter 2 participants 11 messages Feb 22, 2023 – Mar 10, 2023

Subsystems (2)
lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

cover Two minor code fixes

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

Phil Sutter (2):
xlate: Fix for fd leak in error path
xlate: Drop dead code

 lib/ipset.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Signature · 1 line
2.38.0
author reviewer
#1 lore raw

PATCH 1/2 xlate: Fix for fd leak in error path

A rather cosmetic issue though, the program will terminate anyway.

Fixes 325af556cd3a6 ("add ipset to nftables translation infrastructure")
---
 lib/ipset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ipset.c +1 -1
index f57b07413cba5..2e098e435d954 100644
@@ -1999,7 +1999,7 @@ static int ipset_xlate_restore(struct ipset *ipset)
 
 		ret = build_argv(ipset, c);
 		if (ret < 0)
-			return ret;
+			break;
 
 		cmd = ipset_parser(ipset, ipset->newargc, ipset->newargv);
 		if (cmd < 0)
Signature · 1 line
2.38.0
author reviewer
#2 lore raw

PATCH 2/2 xlate: Drop dead code

In reply to Phil Sutter

Set type is not needed when manipulating elements, the assigned variable was unused in that case.

Fixes 325af556cd3a6 ("add ipset to nftables translation infrastructure")
---
 lib/ipset.c | 3 ---
 1 file changed, 3 deletions(-)
lib/ipset.c +0 -3
index 2e098e435d954..8e63af56d2a51 100644
@@ -1876,9 +1876,6 @@ static int ipset_xlate(struct ipset *ipset, enum ipset_cmd cmd,
 				cmd == IPSET_CMD_DEL ? "delete" : "get",
 		       ipset_xlate_family(family), table, set);
 
-		typename = ipset_data_get(data, IPSET_OPT_TYPENAME);
-		type = ipset_xlate_set_type(typename);
-
 		xlate_set = (struct ipset_xlate_set *)
 				ipset_xlate_set_get(ipset, set);
 		if (xlate_set && xlate_set->interval)
Signature · 1 line
2.38.0
#3 lore raw
In reply to Phil Sutter
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

LGTM.

Did you run ipset xlate tests? These should not break those but just in case.

author reviewer
#4 lore raw
Quoted 8 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

LGTM.

Did you run ipset xlate tests? These should not break those but just in case.

I didn't, thanks for the reminder. Testsuite fails, but it does with HEAD as well. And so does the other testsuite ("make tests"), BtW. I'll investigate.

Cheers, Phil

#5 lore raw
Quoted 5 lines · Phil Sutter
Quoted 4 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

Quoted 8 lines
Quoted 4 lines

LGTM.

Did you run ipset xlate tests? These should not break those but just in case.

I didn't, thanks for the reminder. Testsuite fails, but it does with HEAD as well. And so does the other testsuite ("make tests"), BtW. I'll investigate.

Does this work after your testsuite updates? If so, push them out.

author reviewer
#6 lore raw
Quoted 8 lines · Pablo Neira Ayuso
Quoted 7 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

LGTM.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Did you run ipset xlate tests? These should not break those but just in case.

I didn't, thanks for the reminder. Testsuite fails, but it does with HEAD as well. And so does the other testsuite ("make tests"), BtW. I'll investigate.

Does this work after your testsuite updates? If so, push them out.

Yes, it does. Should I push the testsuite updates, too? I'm uncertain about the s/vrrp/carp/, don't want to break anyone's test setup.

Cheers, Phil

#7 lore raw
Quoted 12 lines · Phil Sutter
Quoted 11 lines · Pablo Neira Ayuso
Quoted 10 lines · Phil Sutter
Quoted 8 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

LGTM.

Did you run ipset xlate tests? These should not break those but just in case.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I didn't, thanks for the reminder. Testsuite fails, but it does with HEAD as well. And so does the other testsuite ("make tests"), BtW. I'll investigate.

Does this work after your testsuite updates? If so, push them out.

Yes, it does. Should I push the testsuite updates, too? I'm uncertain about the s/vrrp/carp/, don't want to break anyone's test setup.

I can see some distros still use vrrp en /etc/protocols, yes, I'm ambivalent on this one.

author reviewer
#8 lore raw
Quoted 17 lines · Pablo Neira Ayuso
Quoted 16 lines · Phil Sutter
Quoted 15 lines · Pablo Neira Ayuso
Quoted 13 lines · Phil Sutter
Quoted 8 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

LGTM.

Did you run ipset xlate tests? These should not break those but just in case.

I didn't, thanks for the reminder. Testsuite fails, but it does with HEAD as well. And so does the other testsuite ("make tests"), BtW. I'll investigate.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Does this work after your testsuite updates? If so, push them out.

Yes, it does. Should I push the testsuite updates, too? I'm uncertain about the s/vrrp/carp/, don't want to break anyone's test setup.

I can see some distros still use vrrp en /etc/protocols, yes, I'm ambivalent on this one.

Maybe better just use a different protocol which didn't get "renamed" recently? It's for testing purposes only and the actual value doesn't matter much, right?

#9 lore raw
Quoted 23 lines · Phil Sutter
Quoted 22 lines · Pablo Neira Ayuso
Quoted 20 lines · Phil Sutter
Quoted 8 lines · Pablo Neira Ayuso
Quoted 7 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

LGTM.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Did you run ipset xlate tests? These should not break those but just in case.

I didn't, thanks for the reminder. Testsuite fails, but it does with HEAD as well. And so does the other testsuite ("make tests"), BtW. I'll investigate.

Does this work after your testsuite updates? If so, push them out.

Yes, it does. Should I push the testsuite updates, too? I'm uncertain about the s/vrrp/carp/, don't want to break anyone's test setup.

Quoted 6 lines
Quoted 2 lines

I can see some distros still use vrrp en /etc/protocols, yes, I'm ambivalent on this one.

Maybe better just use a different protocol which didn't get "renamed" recently? It's for testing purposes only and the actual value doesn't matter much, right?

I agree that's fine for a test, yes.

author reviewer
#10 lore raw
In reply to Phil Sutter
Quoted 6 lines · Phil Sutter

These were identified by Coverity tool, no problems in practice. Still worth fixing to reduce noise in code checkers.

Phil Sutter (2):
xlate: Fix for fd leak in error path
xlate: Drop dead code

Series applied.