isdn_ppp: Use common error handling code in isdn_ppp_receive()
Subsystems (3)
PATCH 1/1 isdn_ppp: Use common error handling code in isdn_ppp_receive()
From: Markus Elfring <[email protected]>
Date: Thu, 26 Oct 2017 22:30:50 +0200
Add a jump target so that a bit of exception handling can be better reused at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- drivers/isdn/i4l/isdn_ppp.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/isdn/i4l/isdn_ppp.c +10 -10
@@ -1017,8 +1017,7 @@ void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buffif (slot <0 || slot >=ISDN_MAX_CHANNELS ) {printk (KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n" , lp->ppp_slot); -kfree_skb (skb); -return ; + goto free_skb; } is = ippp_table[slot];
@@ -1028,15 +1027,12 @@ void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buffisdn_ppp_frame_log ("receive" , skb->data, skb->len,32 , is->unit, lp->ppp_slot); } -if (isdn_ppp_skip_ac (is, skb) <0 ) { -kfree_skb (skb); -return ; - } +if (isdn_ppp_skip_ac (is, skb) <0 ) + goto free_skb; + proto =isdn_ppp_strip_proto (skb); -if (proto <0 ) { -kfree_skb (skb); -return ; - } +if (proto <0 ) + goto free_skb;#ifdef CONFIG_ISDN_MPP if (is->compflags &SC_LINK_DECOMP_ON ) {
@@ -1053,6 +1049,10 @@ void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff }#endif isdn_ppp_push_higher (net_dev, lp, skb, proto); +return ; + +free_skb: +kfree_skb (skb); }/*
Signature · 1 line
2.14.3