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>] [day] [month] [year] [list]
Message-ID: <221426d9-d049-b304-d7c1-bdf0a788bf36@users.sourceforge.net>
Date:   Wed, 8 Nov 2017 10:20:08 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-wpan@...r.kernel.org, netdev@...r.kernel.org,
        Alexander Aring <alex.aring@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Johannes Berg <johannes.berg@...el.com>,
        Stefan Schmidt <stefan@....samsung.com>,
        Stephen Hemminger <stephen@...workplumber.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] 6lowpan: Combine two condition checks into one statement in
 lowpan_xmit()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 8 Nov 2017 10:10:41 +0100

The same exception handling was used in an if branch of two
separate statements.

* Merge their condition checks into a single statement instead.

* Delete the local variable "ret" which became unnecessary
  with this refactoring.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 net/ieee802154/6lowpan/tx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c
index e6ff5128e61a..1b0757db2078 100644
--- a/net/ieee802154/6lowpan/tx.c
+++ b/net/ieee802154/6lowpan/tx.c
@@ -255,7 +255,7 @@ static int lowpan_header(struct sk_buff *skb, struct net_device *ldev,
 netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
 {
 	struct ieee802154_hdr wpan_hdr;
-	int max_single, ret;
+	int max_single;
 	u16 dgram_size, dgram_offset;
 
 	pr_debug("package xmit\n");
@@ -269,13 +269,8 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
 	if (!skb)
 		return NET_XMIT_DROP;
 
-	ret = lowpan_header(skb, ldev, &dgram_size, &dgram_offset);
-	if (ret < 0) {
-		kfree_skb(skb);
-		return NET_XMIT_DROP;
-	}
-
-	if (ieee802154_hdr_peek(skb, &wpan_hdr) < 0) {
+	if (lowpan_header(skb, ldev, &dgram_size, &dgram_offset) < 0 ||
+	    ieee802154_hdr_peek(skb, &wpan_hdr) < 0) {
 		kfree_skb(skb);
 		return NET_XMIT_DROP;
 	}
-- 
2.15.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ