patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11] net/dpaa2: fix possible use of uninitialized vars
@ 2019-12-13 10:27 Andrzej Ostruszka
  2019-12-13 11:32 ` Kevin Traynor
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Ostruszka @ 2019-12-13 10:27 UTC (permalink / raw)
  To: stable

[ 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


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

* Re: [dpdk-stable] [PATCH 18.11] net/dpaa2: fix possible use of uninitialized vars
  2019-12-13 10:27 [dpdk-stable] [PATCH 18.11] net/dpaa2: fix possible use of uninitialized vars Andrzej Ostruszka
@ 2019-12-13 11:32 ` Kevin Traynor
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Traynor @ 2019-12-13 11:32 UTC (permalink / raw)
  To: Andrzej Ostruszka, stable

On 13/12/2019 10:27, Andrzej Ostruszka wrote:
> [ 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>

Thanks Andrzej, queued for push next week.


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

end of thread, other threads:[~2019-12-13 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 10:27 [dpdk-stable] [PATCH 18.11] net/dpaa2: fix possible use of uninitialized vars Andrzej Ostruszka
2019-12-13 11:32 ` Kevin Traynor

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).