Skip to content

Commit

Permalink
libteec: fix clang build errors
Browse files Browse the repository at this point in the history
external/optee_client/libteec/src/tee_client_api.c:488:11: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t data[sizeof(struct tee_ioctl_open_session_arg) + p_sz];
                        ^
external/optee_client/libteec/src/tee_client_api.c:566:11: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t data[sizeof(struct tee_ioctl_invoke_arg) + p_sz];
                        ^

Fixes: 9dbc61b ("libteec: fix build warnings")
Fixes: #152

Signed-off-by: Victor Chong <victor.chong@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
Victor Chong authored and jforissier committed Mar 22, 2019
1 parent 924a474 commit 16c8f54
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions libteec/src/tee_client_api.c
Expand Up @@ -490,11 +490,12 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *ctx, TEEC_Session *session,
TEEC_Result res = 0;
uint32_t eorig = 0;
int rc = 0;
size_t p_sz = TEEC_CONFIG_PAYLOAD_REF_COUNT *
sizeof(struct tee_ioctl_param);
const size_t arg_size = sizeof(struct tee_ioctl_open_session_arg) +
TEEC_CONFIG_PAYLOAD_REF_COUNT *
sizeof(struct tee_ioctl_param);
union {
struct tee_ioctl_open_session_arg arg;
uint8_t data[sizeof(struct tee_ioctl_open_session_arg) + p_sz];
uint8_t data[arg_size];
} buf;
struct tee_ioctl_buf_data buf_data;
TEEC_SharedMemory shm[TEEC_CONFIG_PAYLOAD_REF_COUNT];
Expand Down Expand Up @@ -572,11 +573,12 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t cmd_id,
TEEC_Result res = 0;
uint32_t eorig = 0;
int rc = 0;
size_t p_sz = TEEC_CONFIG_PAYLOAD_REF_COUNT *
sizeof(struct tee_ioctl_param);
const size_t arg_size = sizeof(struct tee_ioctl_invoke_arg) +
TEEC_CONFIG_PAYLOAD_REF_COUNT *
sizeof(struct tee_ioctl_param);
union {
struct tee_ioctl_invoke_arg arg;
uint8_t data[sizeof(struct tee_ioctl_invoke_arg) + p_sz];
uint8_t data[arg_size];
} buf;
struct tee_ioctl_buf_data buf_data;
TEEC_SharedMemory shm[TEEC_CONFIG_PAYLOAD_REF_COUNT];
Expand Down

0 comments on commit 16c8f54

Please sign in to comment.