public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: coverity-bot <keescook@chromium.org>
To: Michael Walle <michael@walle.cc>
Cc: Guenter Roeck <linux@roeck-us.net>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org
Subject: Coverity: bcm54140_hwmon_read_in(): Control flow issues
Date: Thu, 23 Apr 2020 12:15:54 -0700	[thread overview]
Message-ID: <202004231215.83D617E9C4@keescook> (raw)

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@chromium.org>
Addresses-Coverity-ID: 1492709 ("Control flow issues")
Fixes: 4406d36dfdf1 ("net: phy: bcm54140: add hwmon support")

Thanks for your attention!

-- 
Coverity-bot

                 reply	other threads:[~2020-04-23 19:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202004231215.83D617E9C4@keescook \
    --to=keescook@chromium.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=linux-next@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=michael@walle.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox