Skip to contentSkip to conversation

src: rule: Fix list of set: Add a forgotten 'return'

PATCH In review Ana Rey 2 participants 2 messages Apr 8, 2014 netfilter

lore
Share & tools
lore

Ana Rey

author
#0 lore raw

PATCH 1/1 src: rule: Fix list of set: Add a forgotten 'return'

Add a return forgotten.
It adds a exit in the function and It avoids executing unnecessary code.

---
 src/rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/rule.c +1 -1
index 00dedf5..18ae6b1 100644
@@ -674,7 +674,7 @@ static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd)
 				return -1;
 			set_print(set);
 		}
-		break;
+		return 0;
 	case CMD_OBJ_SET:
 		if (netlink_get_set(ctx, &cmd->handle, &cmd->location) < 0)
 			return -1;
Signature · 1 line
1.9.0
#1 lore raw
Quoted 1 line · Ana Rey

Add a return forgotten.

I prefer if you include in the patch description the important facts:

* This patch fixes a crash since this iterates over the temporary context list a bit below on that code to handle table and chains (that we don't have in this case).

* Something descriptive on how this happens, eg.

% nft list sets
Segmentation fault

Or even better:

% valgrind nft list sets
...
valgrind report goes here.
...

Please, also rework the title:

src: rule: Fix list of set: Add a forgotten 'return'

something much more simple like:

rule: fix crash in set listing

should be fine.