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: <1a05cc59-2d61-0152-798e-4d2f75094129@users.sourceforge.net>
Date:   Wed, 10 Jan 2018 11:24:51 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     kernel-janitors@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        Cliff Whickman <cpw@....com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Robin Holt <robinmholt@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 3/4] sgi-xpnet: Use common code in xpnet_dev_hard_start_xmit()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 10 Jan 2018 10:50:10 +0100

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

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/misc/sgi-xp/xpnet.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index a4415616c03c..088c96a883f9 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -416,11 +416,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		"skb->end=0x%p skb->len=%d\n", (void *)skb->head,
 		(void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb),
 		skb->len);
-
-	if (skb->data[0] == 0x33) {
-		dev_kfree_skb(skb);
-		return NETDEV_TX_OK;	/* nothing needed to be done */
-	}
+	if (skb->data[0] == 0x33)
+		goto free_skb;
 
 	/*
 	 * The xpnet_pending_msg tracks how many outstanding
@@ -430,8 +427,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	queued_msg = kmalloc(sizeof(*queued_msg), GFP_ATOMIC);
 	if (queued_msg == NULL) {
 		dev->stats.tx_errors++;
-		dev_kfree_skb(skb);
-		return NETDEV_TX_OK;
+		goto free_skb;
 	}
 
 	/* get the beginning of the first cacheline and end of last */
@@ -479,11 +475,15 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	dev->stats.tx_bytes += skb->len;
 
 	if (atomic_dec_return(&queued_msg->use_count) == 0) {
-		dev_kfree_skb(skb);
 		kfree(queued_msg);
+		goto free_skb;
 	}
 
 	return NETDEV_TX_OK;
+
+free_skb:
+	dev_kfree_skb(skb);
+	return NETDEV_TX_OK;
 }
 
 /*
-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ