lkml.org 
[lkml]   [2017]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/3] net: sched: cls_fw: Use common error handling code in fw_change()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 19:15:08 +0100

Add a jump target so that a bit of exception handling can be better reused
in an if branch of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/sched/cls_fw.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 5908f56f76da..567db4d2349f 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -281,14 +281,13 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
fnew->tp = f->tp;

err = tcf_exts_init(&fnew->exts, TCA_FW_ACT, TCA_FW_POLICE);
- if (err < 0) {
- kfree(fnew);
- return err;
- }
+ if (err < 0)
+ goto free_filter;

err = fw_set_parms(net, tp, fnew, tb, tca, base, ovr);
if (err < 0) {
tcf_exts_destroy(&fnew->exts);
+free_filter:
kfree(fnew);
return err;
}
--
2.15.0
\
 
 \ /
  Last update: 2017-11-08 21:15    [W:0.036 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site