From: Andrzej Ostruszka <aostruszka@marvell.com>
To: <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH 18.11] net/dpaa2: fix possible use of uninitialized vars
Date: Fri, 13 Dec 2019 11:27:36 +0100 [thread overview]
Message-ID: <20191213102736.16867-1-aostruszka@marvell.com> (raw)
[ upstream commit 7bbc7dc431a66e81514219f1734ed263a3db3359 ]
This patch fixes 'maybe-uninitialized' warnings reported by compiler
when using LTO.
Compiler warning pointing to this error (with LTO enabled):
error: ‘kg_cfg.extracts[0].masks[0].mask’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
Fixes: 16bbc98a3e63 ("bus/fslmc: update MC to 10.3.x")
Cc: stable@dpdk.org
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
---
drivers/net/dpaa2/mc/dpkg.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dpaa2/mc/dpkg.c b/drivers/net/dpaa2/mc/dpkg.c
index 80f94f40e..1e171eedc 100644
--- a/drivers/net/dpaa2/mc/dpkg.c
+++ b/drivers/net/dpaa2/mc/dpkg.c
@@ -63,7 +63,10 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf)
dpkg_set_field(extr->extract_type, EXTRACT_TYPE,
cfg->extracts[i].type);
- for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
+ if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS)
+ return -EINVAL;
+
+ for (j = 0; j < extr->num_of_byte_masks; j++) {
extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
extr->masks[j].offset =
cfg->extracts[i].masks[j].offset;
--
2.17.1
next reply other threads:[~2019-12-13 10:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 10:27 Andrzej Ostruszka [this message]
2019-12-13 11:32 ` Kevin Traynor
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=20191213102736.16867-1-aostruszka@marvell.com \
--to=aostruszka@marvell.com \
--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).