From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Andrew Lee <alee@solarflare.com>, <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH 52/53] net/sfc/base: fix PreFAST static analysis warning (C6001)
Date: Thu, 16 Nov 2017 08:04:40 +0000 [thread overview]
Message-ID: <1510819481-6809-53-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1510819481-6809-1-git-send-email-arybchenko@solarflare.com>
From: Andrew Lee <alee@solarflare.com>
Fix warning
"C6001: Using uninitialized memory '*sensor_maskp'"
which could occur when the npages argument to efx_mcdi_sensor_info()
is less than or equal to zero.
Fixes: dfb3b1ce15f6 ("net/sfc/base: import monitors access via MCDI")
Cc: stable@dpdk.org
Signed-off-by: Andrew Lee <alee@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/base/mcdi_mon.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sfc/base/mcdi_mon.c b/drivers/net/sfc/base/mcdi_mon.c
index 8ea4216..7e4264a 100644
--- a/drivers/net/sfc/base/mcdi_mon.c
+++ b/drivers/net/sfc/base/mcdi_mon.c
@@ -396,6 +396,11 @@ efx_mcdi_sensor_info(
EFSYS_ASSERT(sensor_maskp != NULL);
+ if (npages < 1) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
for (page = 0; page < npages; page++) {
uint32_t mask;
@@ -412,7 +417,7 @@ efx_mcdi_sensor_info(
if (req.emr_rc != 0) {
rc = req.emr_rc;
- goto fail1;
+ goto fail2;
}
mask = MCDI_OUT_DWORD(req, SENSOR_INFO_OUT_MASK);
@@ -420,18 +425,20 @@ efx_mcdi_sensor_info(
if ((page != (npages - 1)) &&
((mask & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) == 0)) {
rc = EINVAL;
- goto fail2;
+ goto fail3;
}
sensor_maskp[page] = mask;
}
if (sensor_maskp[npages - 1] & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) {
rc = EINVAL;
- goto fail3;
+ goto fail4;
}
return (0);
+fail4:
+ EFSYS_PROBE(fail4);
fail3:
EFSYS_PROBE(fail3);
fail2:
--
2.7.4
prev parent reply other threads:[~2017-11-16 8:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1510819481-6809-1-git-send-email-arybchenko@solarflare.com>
2017-11-16 8:03 ` [dpdk-stable] [PATCH 03/53] net/sfc/base: fix result code in MCDI NVRAM update finish Andrew Rybchenko
2017-11-16 8:03 ` [dpdk-stable] [PATCH 11/53] net/sfc/base: fix check in NVRAM validate Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 15/53] net/sfc/base: fix PreFAST issues Andrew Rybchenko
2017-11-27 19:58 ` Ferruh Yigit
2017-11-28 11:49 ` Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 34/53] net/sfc/base: fix build issue with PHY LED control enabled Andrew Rybchenko
2017-11-27 19:59 ` Ferruh Yigit
2017-11-16 8:04 ` [dpdk-stable] [PATCH 41/53] net/sfc/base: fix diagnostics support build without Siena Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 42/53] net/sfc/base: fix probes in licensing support Andrew Rybchenko
2017-11-27 19:58 ` Ferruh Yigit
2017-11-28 10:17 ` Andrew Rybchenko
2017-11-28 21:38 ` Ferruh Yigit
2017-11-29 9:51 ` Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 43/53] net/sfc/base: fix warnings from VS2015 C compiler (C4310) Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 44/53] net/sfc/base: fix warnings from VS2015 C compiler (C4244) Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 45/53] net/sfc/base: fix warnings from VS2015 C compiler (C4245) Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 46/53] net/sfc/base: fix warnings from VS2015 C compiler (C4100) Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 47/53] net/sfc/base: fix warnings from VS2015 C compiler (C4189) Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 48/53] net/sfc/base: fix warnings from VS2015 C compiler (C4057) Andrew Rybchenko
2017-11-16 8:04 ` [dpdk-stable] [PATCH 49/53] net/sfc/base: fix warnings from VS2015 C compiler (C4214) Andrew Rybchenko
2017-11-16 8:04 ` Andrew Rybchenko [this message]
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=1510819481-6809-53-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=alee@solarflare.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).