lkml.org 
[lkml]   [2015]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] mISDN: One function call less in mISDN_sock_sendmsg() after error detection
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 16 Nov 2015 10:30:29 +0100

The kfree_skb() function was called in one case by the
mISDN_sock_sendmsg() function during error handling even if a call of
the _l2_alloc_skb() function returned a null pointer.

This implementation detail could be improved by the introduction
of another jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/isdn/mISDN/socket.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index edd16ef..430ac8c 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -200,7 +200,7 @@ mISDN_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)

skb = _l2_alloc_skb(len, GFP_KERNEL);
if (!skb)
- goto done;
+ goto release_socket;

if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
err = -EFAULT;
@@ -237,6 +237,7 @@ mISDN_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)

done:
kfree_skb(skb);
+release_socket:
release_sock(sk);
return err;
}
--
2.6.2

\
 
 \ /
  Last update: 2015-11-16 11:01    [W:1.341 / U:18.748 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site