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-next>] [day] [month] [year] [list]
Date:   Tue, 15 Mar 2022 15:49:52 +0800
From:   Meng Tang <tangmeng@...ontech.com>
To:     davem@...emloft.net, kuba@...nel.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Meng Tang <tangmeng@...ontech.com>
Subject: [PATCH] net: tulip: de4x5: Optimize if branch in de4x5_parse_params

In the de4x5_parse_params, 'if (strstr(p, "BNC_AUI"))' condition and
'if (strstr(p, "BNC_AUI"))' condition are both execute the statement
'lp->params.autosense = BNC', these two conditions can be combined.

In addition, in the current code logic, when p = "BNC", the judgments
need to be executed four times. In order to simplify the execution
process and keep the original code design, I used the statement which
is 'if (strstr(p, "BNC") || strstr(p, "BNC_AUI"))' to deal with it,
after that once 'strstr(p, "BNC")' is established, we no longer need
to judge whether 'strstr(p, "BNC_AUI")' is true(not NULL).

In this way, we can execute the judgment statement one time less.

Signed-off-by: Meng Tang <tangmeng@...ontech.com>
---
 drivers/net/ethernet/dec/tulip/de4x5.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
index 71730ef4cd57..5900b8ef7f6f 100644
--- a/drivers/net/ethernet/dec/tulip/de4x5.c
+++ b/drivers/net/ethernet/dec/tulip/de4x5.c
@@ -5208,9 +5208,7 @@ de4x5_parse_params(struct net_device *dev)
 		lp->params.autosense = TP_NW;
 	    } else if (strstr(p, "TP")) {
 		lp->params.autosense = TP;
-	    } else if (strstr(p, "BNC_AUI")) {
-		lp->params.autosense = BNC;
-	    } else if (strstr(p, "BNC")) {
+	    } else if (strstr(p, "BNC") || strstr(p, "BNC_AUI")) {
 		lp->params.autosense = BNC;
 	    } else if (strstr(p, "AUI")) {
 		lp->params.autosense = AUI;
-- 
2.20.1


ÿÿÿÿÿ	.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ