Coverity: bcm54140_hwmon_read_in(): Control flow issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20200423 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Mon Apr 20 20:21:13 2020 +0200
    4406d36dfdf1 ("net: phy: bcm54140: add hwmon support")

Coverity reported the following:

*** CID 1492709:  Control flow issues  (NO_EFFECT)
/drivers/net/phy/bcm54140.c: 247 in bcm54140_hwmon_read_in()
241     		return bcm54140_hwmon_read_alarm(dev, bit, val);
242     	default:
243     		return -EOPNOTSUPP;
244     	}
245
246     	tmp = bcm_phy_read_rdb(phydev, reg);
vvv     CID 1492709:  Control flow issues  (NO_EFFECT)
vvv     This less-than-zero comparison of an unsigned value is never true. "tmp < 0".
247     	if (tmp < 0)
248     		return tmp;
249
250     	tmp &= BCM54140_HWMON_IN_MASK(channel);
251     	*val = BCM54140_HWMON_TO_IN(channel, tmp);
252

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Human edit:
This is present on line 214 as well. (bcm_phy_read_rdb() returns int,
but tmp is u16.)

Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
Addresses-Coverity-ID: 1492709 ("Control flow issues")
Fixes: 4406d36dfdf1 ("net: phy: bcm54140: add hwmon support")

Thanks for your attention!

-- 
Coverity-bot



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux