linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] net: phy: fix less than zero comparison with unsigned variable val
@ 2020-05-07 14:34 Colin King
  2020-05-08  1:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-05-07 14:34 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
	David S . Miller, Oleksij Rempel, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The unsigned variable val is being checked for an error by checking
if it is less than zero. This can never occur because val is unsigned.
Fix this by making val a plain int.

Addresses-Coverity: ("Unsigned compared against zero")
Fixes: bdbdac7649fa ("ethtool: provide UAPI for PHY master/slave configuration.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 83fc8e1b5793..c3a107cf578e 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1948,7 +1948,7 @@ static int genphy_setup_master_slave(struct phy_device *phydev)
 static int genphy_read_master_slave(struct phy_device *phydev)
 {
 	int cfg, state;
-	u16 val;
+	int val;
 
 	if (!phydev->is_gigabit_capable) {
 		phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] net: phy: fix less than zero comparison with unsigned variable val
  2020-05-07 14:34 [PATCH][next] net: phy: fix less than zero comparison with unsigned variable val Colin King
@ 2020-05-08  1:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-05-08  1:07 UTC (permalink / raw)
  To: colin.king
  Cc: andrew, f.fainelli, hkallweit1, linux, linux, netdev,
	kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Thu,  7 May 2020 15:34:30 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The unsigned variable val is being checked for an error by checking
> if it is less than zero. This can never occur because val is unsigned.
> Fix this by making val a plain int.
> 
> Addresses-Coverity: ("Unsigned compared against zero")
> Fixes: bdbdac7649fa ("ethtool: provide UAPI for PHY master/slave configuration.")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks Colin.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-08  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 14:34 [PATCH][next] net: phy: fix less than zero comparison with unsigned variable val Colin King
2020-05-08  1:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).