aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/crypto/crypto.h
diff options
context:
space:
mode:
authorLijian Zhang <Lijian.Zhang@arm.com>2019-09-27 16:25:35 +0800
committerNeale Ranns <nranns@cisco.com>2019-11-12 16:57:11 +0000
commitb15d796dbf1da6a229df4e10a3a2bdd700f0354e (patch)
treec6ad29d3e370e990891488c1cf48f1fc867c0d64 /src/vnet/crypto/crypto.h
parentf8461bfb4822ca20f64df19dfbb3170e99f7e89d (diff)
crypto: not use vec api with opt_data[VNET_CRYPTO_N_OP_IDS]
opt_data is defined as a array, while in some code, e.g., function vnet_crypto_get_op_type, it's used as vec. vec api is not applicable to static arraies. src/vnet/crypto/crypto.h:234:70: error: address of array 'cm->opt_data' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] vnet_crypto_op_data_t *od = ({ do { if ((0 > 0) && ! ((id) < ((cm->opt_data) ? (((vec_header_t *) (cm->opt_data) - 1)->len) : 0))) Type: fix Change-Id: I0b6754406e4216ca975bc1da4b5d4ce293a9bb45 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com>
Diffstat (limited to 'src/vnet/crypto/crypto.h')
-rw-r--r--src/vnet/crypto/crypto.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vnet/crypto/crypto.h b/src/vnet/crypto/crypto.h
index 9326a078f8a..626e71d5030 100644
--- a/src/vnet/crypto/crypto.h
+++ b/src/vnet/crypto/crypto.h
@@ -231,7 +231,8 @@ static_always_inline vnet_crypto_op_type_t
vnet_crypto_get_op_type (vnet_crypto_op_id_t id)
{
vnet_crypto_main_t *cm = &crypto_main;
- vnet_crypto_op_data_t *od = vec_elt_at_index (cm->opt_data, id);
+ ASSERT (id < VNET_CRYPTO_N_OP_IDS);
+ vnet_crypto_op_data_t *od = cm->opt_data + id;
return od->type;
}