From a18dcb5ed1c48c3ffae6ccb8e01fa5202d3d65b0 Mon Sep 17 00:00:00 2001 From: Yogaraj Alamenda Date: Fri, 28 Oct 2016 08:33:56 +0100 Subject: [PATCH] Fix array indexing error and compilation warning Change-Id: I3cc3b3ca2e32a94dee284615ce5e9bed35abc85c Signed-off-by: Steve Linsell --- e_qat.c | 4 ++-- qat_ciphers.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/e_qat.c b/e_qat.c index 4d33951f..ef6ad2cd 100644 --- a/e_qat.c +++ b/e_qat.c @@ -1207,7 +1207,7 @@ static int qat_engine_finish(ENGINE *e) } if (0 == enable_external_polling && !qat_is_event_driven()) { - if ((pthread_t *) icp_polling_threads[i] != 0) { + if ((pthread_t *) icp_polling_threads[i] != NULL) { pthread_join(icp_polling_threads[i], NULL); } } @@ -1217,7 +1217,7 @@ static int qat_engine_finish(ENGINE *e) } if (0 == enable_external_polling && qat_is_event_driven()) { - if ((pthread_t *) icp_polling_threads[0] != 0) { + if ((pthread_t *) icp_polling_threads[0] != NULL) { pthread_join(icp_polling_threads[0], NULL); } } diff --git a/qat_ciphers.c b/qat_ciphers.c index cc39c348..82f987f3 100644 --- a/qat_ciphers.c +++ b/qat_ciphers.c @@ -327,12 +327,13 @@ static unsigned long pkt_threshold_table_hash(const PKT_THRESHOLD * a) LHASH_OF(PKT_THRESHOLD) *qat_create_pkt_threshold_table(void) { int i; + int tbl_size = (sizeof(qat_pkt_threshold_table) / sizeof(qat_pkt_threshold_table[0])); LHASH_OF(PKT_THRESHOLD) *ret = NULL; ret = lh_PKT_THRESHOLD_new(pkt_threshold_table_hash,pkt_threshold_table_cmp); if(ret == NULL) { return ret; } - for(i = 0; i < sizeof(qat_pkt_threshold_table);i++) { + for(i = 0; i < tbl_size; i++) { lh_PKT_THRESHOLD_insert(ret,&qat_pkt_threshold_table[i]); } return ret;