Skip to contentSkip to conversation

ipsec: fix use of uninitialized variable

PATCH Applied Konstantin Ananyev 4 participants 4 messages Feb 19, 2020 – Feb 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipsec: fix use of uninitialized variable

Defects reported by coverity scan
uninit_use_in_call: Using uninitialized element of array clen when calling cpu_crypto_bulk.

Coverity issue: 354233, 354234

Fixes 957394f72658 ("ipsec: support CPU crypto mode")
---
 lib/librte_ipsec/esp_inb.c  | 4 +++-
 lib/librte_ipsec/esp_outb.c | 4 +++-
 lib/librte_ipsec/misc.h     | 3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)
lib/librte_ipsec/esp_inb.c +3 -1
index 7b8ab81f6..96eec0131 100644
@@ -737,7 +737,9 @@ cpu_inb_pkt_prepare(const struct rte_ipsec_session *ss,
 		move_bad_mbufs(mb, dr, num, num - k);
 
 	/* convert mbufs to iovecs and do actual crypto/auth processing */
-	cpu_crypto_bulk(ss, sa->cofs, mb, iv, aad, dgst, l4ofs, clen, k);
+	if (k != 0)
+		cpu_crypto_bulk(ss, sa->cofs, mb, iv, aad, dgst,
+			l4ofs, clen, k);
 	return k;
 }
 
lib/librte_ipsec/esp_outb.c +3 -1
index b6d9cbe98..fb9d5864c 100644
@@ -502,7 +502,9 @@ cpu_outb_pkt_prepare(const struct rte_ipsec_session *ss,
 		move_bad_mbufs(mb, dr, n, n - k);
 
 	/* convert mbufs to iovecs and do actual crypto/auth processing */
-	cpu_crypto_bulk(ss, sa->cofs, mb, iv, aad, dgst, l4ofs, clen, k);
+	if (k != 0)
+		cpu_crypto_bulk(ss, sa->cofs, mb, iv, aad, dgst,
+			l4ofs, clen, k);
 	return k;
 }
 
lib/librte_ipsec/misc.h +2 -1
index 53c0457af..771602950 100644
@@ -106,7 +106,8 @@ mbuf_cut_seg_ofs(struct rte_mbuf *mb, struct rte_mbuf *ms, uint32_t ofs,
 }
 
 /*
- * process packets using sync crypto engine
+ * process packets using sync crypto engine.
+ * expects *num* to be greater then zero.
  */
 static inline void
 cpu_crypto_bulk(const struct rte_ipsec_session *ss,
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Konstantin Ananyev
Sent: Wednesday, February 19, 2020 12:23 AM
To: [email protected]
Cc: [email protected]; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH] ipsec: fix use of uninitialized variable

Quoted 8 lines

Defects reported by coverity scan
uninit_use_in_call: Using uninitialized element of array clen when calling cpu_crypto_bulk.

Coverity issue: 354233, 354234

Fixes 957394f72658 ("ipsec: support CPU crypto mode")
#2 lore raw
Quoted 20 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Iremonger, Bernard
Sent: Wednesday, February 19, 2020 2:15 PM
To: Ananyev, Konstantin <[email protected]>; [email protected]
Cc: [email protected]; Ananyev, Konstantin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] ipsec: fix use of uninitialized variable

Quoted 12 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Konstantin Ananyev
Sent: Wednesday, February 19, 2020 12:23 AM
To: [email protected]
Cc: [email protected]; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH] ipsec: fix use of uninitialized variable

Defects reported by coverity scan
uninit_use_in_call: Using uninitialized element of array clen when calling cpu_crypto_bulk.

Quoted 6 lines
Quoted 4 lines

Coverity issue: 354233, 354234

Fixes 957394f72658 ("ipsec: support CPU crypto mode")

If possible can we get this merged into RC4.

Applied
#3 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Defects reported by coverity scan
uninit_use_in_call: Using uninitialized element of array clen when calling cpu_crypto_bulk.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Coverity issue: 354233, 354234

Fixes 957394f72658 ("ipsec: support CPU crypto mode")

If possible can we get this merged into RC4.

Applied to dpdk-next-crypto

Thanks.