lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7db5b0d-2bd4-367c-bd29-4c33155bb22d@users.sourceforge.net>
Date:   Thu, 12 Oct 2017 12:48:03 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     devel@...verdev.osuosl.org, netdev@...r.kernel.org,
        Al Viro <viro@...iv.linux.org.uk>,
        Corentin Labbe <clabbe.montjoie@...il.com>,
        David Howells <dhowells@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        Georgiana Chelu <georgiana.chelu93@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Johannes Berg <johannes.berg@...el.com>,
        Julia Lawall <julia.lawall@...6.fr>,
        Samuel Ortiz <samuel@...tiz.org>,
        Srishti Sharma <srishtishar@...il.com>,
        Stephen Hemminger <stephen@...workplumber.org>,
        Yuan Linyu <Linyu.Yuan@...atel-sbell.com.cn>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 08/10] staging/irda/net: Use common error handling code in
 irias_new_object()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 12 Oct 2017 08:52:53 +0200

Add a jump target so that a bit of exception handling can be better
reused at the end of this function.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/staging/irda/net/irias_object.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/irda/net/irias_object.c b/drivers/staging/irda/net/irias_object.c
index 4c2c65e28836..0c89800d597d 100644
--- a/drivers/staging/irda/net/irias_object.c
+++ b/drivers/staging/irda/net/irias_object.c
@@ -54,10 +54,9 @@ struct ias_object *irias_new_object( char *name, int id)
 
 	obj->magic = IAS_OBJECT_MAGIC;
 	obj->name = kstrndup(name, IAS_MAX_CLASSNAME, GFP_ATOMIC);
-	if (!obj->name) {
-		kfree(obj);
-		return NULL;
-	}
+	if (!obj->name)
+		goto free_object;
+
 	obj->id = id;
 
 	/* Locking notes : the attrib spinlock has lower precendence
@@ -68,11 +67,14 @@ struct ias_object *irias_new_object( char *name, int id)
 		net_warn_ratelimited("%s(), Unable to allocate attribs!\n",
 				     __func__);
 		kfree(obj->name);
-		kfree(obj);
-		return NULL;
+		goto free_object;
 	}
 
 	return obj;
+
+free_object:
+	kfree(obj);
+	return NULL;
 }
 EXPORT_SYMBOL(irias_new_object);
 
-- 
2.14.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ