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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 20 Dec 2021 13:25:01 +0100
From:   Anders Roxell <anders.roxell@...aro.org>
To:     stable@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, woojung.huh@...rochip.com,
        UNGLinuxDriver@...rochip.com, davem@...emloft.net,
        netdev@...r.kernel.org, linux-usb@...r.kernel.org,
        clang-built-linux@...glegroups.com, ulli.kroll@...glemail.com,
        linux@...linux.org.uk, linux-arm-kernel@...ts.infradead.org,
        amitkarwar@...il.com, nishants@...vell.com, gbhat@...vell.com,
        huxinming820@...il.com, kvalo@...eaurora.org,
        linux-wireless@...r.kernel.org, rostedt@...dmis.org,
        mingo@...hat.com, dmitry.torokhov@...il.com,
        ndesaulniers@...gle.com, nathan@...nel.org,
        linux-input@...r.kernel.org,
        Nathan Chancellor <natechancellor@...il.com>,
        Anders Roxell <anders.roxell@...aro.org>
Subject: [PATCH 4.14 1/6] net: lan78xx: Avoid unnecessary self assignment

From: Nathan Chancellor <natechancellor@...il.com>

commit 94e7c844990f0db92418586b107be135b4963b66 upstream.

Clang warns when a variable is assigned to itself.

drivers/net/usb/lan78xx.c:940:11: warning: explicitly assigning value of
variable of type 'u32' (aka 'unsigned int') to itself [-Wself-assign]
                        offset = offset;
                        ~~~~~~ ^ ~~~~~~
1 warning generated.

Reorder the if statement to acheive the same result and avoid a self
assignment warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/129
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Anders Roxell <anders.roxell@...aro.org>
---
 drivers/net/usb/lan78xx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 838b6fe9dfaa..e286188b6ea1 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -920,11 +920,9 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset,
 	ret = lan78xx_read_raw_otp(dev, 0, 1, &sig);
 
 	if (ret == 0) {
-		if (sig == OTP_INDICATOR_1)
-			offset = offset;
-		else if (sig == OTP_INDICATOR_2)
+		if (sig == OTP_INDICATOR_2)
 			offset += 0x100;
-		else
+		else if (sig != OTP_INDICATOR_1)
 			ret = -EINVAL;
 		if (!ret)
 			ret = lan78xx_read_raw_otp(dev, offset, length, data);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ