netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nftables PATCH] src: rule: Fix list of set: Add a forgotten 'return'
@ 2014-04-08  7:19 Ana Rey
  2014-04-08  7:35 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Ana Rey @ 2014-04-08  7:19 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Ana Rey

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

Signed-off-by: Ana Rey <anarey@gmail.com>
---
 src/rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rule.c b/src/rule.c
index 00dedf5..18ae6b1 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -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;
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [nftables PATCH] src: rule: Fix list of set: Add a forgotten 'return'
  2014-04-08  7:19 [nftables PATCH] src: rule: Fix list of set: Add a forgotten 'return' Ana Rey
@ 2014-04-08  7:35 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-04-08  7:35 UTC (permalink / raw)
  To: Ana Rey; +Cc: netfilter-devel

On Tue, Apr 08, 2014 at 09:19:27AM +0200, Ana Rey wrote:
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-08  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-08  7:19 [nftables PATCH] src: rule: Fix list of set: Add a forgotten 'return' Ana Rey
2014-04-08  7:35 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).