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: <20220405001253.22120-1-xiam0nd.tong@gmail.com>
Date:   Tue,  5 Apr 2022 08:12:53 +0800
From:   Xiaomeng Tong <xiam0nd.tong@...il.com>
To:     jassisinghbrar@...il.com, thierry.reding@...il.com,
        jonathanh@...dia.com
Cc:     linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
        Xiaomeng Tong <xiam0nd.tong@...il.com>
Subject: [RESEND][PATCH v2] myri10ge: remove an unneeded NULL check

The define of skb_list_walk_safe(first, skb, next_skb) is:
  for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb);  \
     (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)

Thus, if the 'segs' passed as 'first' into the skb_list_walk_safe is NULL,
the loop will exit immediately. In other words, it can be sure the 'segs'
is non-NULL when we run inside the loop. So just remove the unnecessary
NULL check. Also remove the unneeded assignmnets.

Signed-off-by: Xiaomeng Tong <xiam0nd.tong@...il.com>
---
changes since v1:
 - remove the unneeded assignmnets.

v1: https://lore.kernel.org/lkml/20220319052350.26535-1-xiam0nd.tong@gmail.com/
---
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 50ac3ee2577a..071657e3dba8 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -2903,12 +2903,8 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
 		status = myri10ge_xmit(curr, dev);
 		if (status != 0) {
 			dev_kfree_skb_any(curr);
-			if (segs != NULL) {
-				curr = segs;
-				segs = next;
-				curr->next = NULL;
-				dev_kfree_skb_any(segs);
-			}
+			segs->next = NULL;
+			dev_kfree_skb_any(next);
 			goto drop;
 		}
 	}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ