patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] crypto/qat: fix uninitilized compiler warning
@ 2021-05-14  7:41 Feifei Wang
  2021-05-14  7:49 ` David Marchand
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Feifei Wang @ 2021-05-14  7:41 UTC (permalink / raw)
  To: John Griffin, Fiona Trahe, Deepak Kumar Jain, Herbert Guan, Jerin Jacob
  Cc: dev, nd, Feifei Wang, stable, Ruifeng Wang

In Arm platform, when "RTE_ARCH_ARM64_MEMCPY" is set as true, compiler
will report variable uninitilized warning:

../drivers/crypto/qat/qat_sym_session.c: In function ‘partial_hash_compute’:
../lib/eal/include/generic/rte_byteorder.h:241:24: warning:
‘<U35a0>’ may be used uninitialized in this function
	[-Wmaybe-uninitialized]
	241 | #define rte_bswap32(x) __builtin_bswap32(x)
	...

This is because "digest" will be initialized by "rte_memcpy" function
rather than "memcpy" if "RTE_ARCH_ARM64_MEMCPY" is set as true. However,
compiler cannot know it is initialized by the function.

To fix this, use "calloc" to initialize "digest".

Fixes: cd7fc8a84b48 ("eal/arm64: optimize memcpy")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 drivers/crypto/qat/qat_sym_session.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 231b1640da..dab23a3290 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -1190,8 +1190,8 @@ static int partial_hash_compute(enum icp_qat_hw_auth_algo hash_alg,
 			uint8_t *data_out)
 {
 	int digest_size;
-	uint8_t digest[qat_hash_get_digest_size(
-			ICP_QAT_HW_AUTH_ALGO_DELIMITER)];
+	uint8_t *digest = (uint8_t *)calloc(qat_hash_get_digest_size(
+				ICP_QAT_HW_AUTH_ALGO_DELIMITER), sizeof(uint8_t));
 	uint32_t *hash_state_out_be32;
 	uint64_t *hash_state_out_be64;
 	int i;
-- 
2.25.1


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

end of thread, other threads:[~2021-06-29 20:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14  7:41 [dpdk-stable] [PATCH] crypto/qat: fix uninitilized compiler warning Feifei Wang
2021-05-14  7:49 ` David Marchand
2021-05-14  8:01   ` [dpdk-stable] 回复: " Feifei Wang
2021-05-14  8:13     ` [dpdk-stable] " David Marchand
2021-05-14  8:30       ` [dpdk-stable] 回复: " Feifei Wang
2021-05-17  9:07 ` [dpdk-stable] [PATCH v3] " Feifei Wang
2021-05-19  7:56   ` Thomas Monjalon
2021-05-19  8:11   ` Ferruh Yigit
2021-05-20  5:44     ` [dpdk-stable] 回复: " Feifei Wang
2021-05-20  8:08       ` Ferruh Yigit
2021-05-19 13:13   ` [dpdk-stable] [dpdk-dev] " Dybkowski, AdamX
2021-05-19 13:16   ` Dybkowski, AdamX
2021-05-20  5:47     ` [dpdk-stable] 回复: " Feifei Wang
2021-05-20  8:43 ` [dpdk-stable] [PATCH v4] crypto/qat: fix uninitilized gcc " Feifei Wang
2021-05-20  9:06   ` Dybkowski, AdamX
2021-05-21  2:00 ` [dpdk-stable] [PATCH v5] crypto/qat: fix uninitialized " Feifei Wang
2021-06-29 20:04   ` [dpdk-stable] [EXT] [dpdk-dev] " Akhil Goyal

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