Skip to content

Commit 0f58198

Browse files
authored
Arm backend: Fix ubsan warning in example runner (#15846)
Avoid dangerous pointer arithmetic by making sure EValue lands at its natural alignment (8 bytes on this target). Signed-off-by: [email protected]
1 parent 3bbe173 commit 0f58198

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

backends/arm/test/test_arm_baremetal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ test_memory_allocation() {
390390
--require "model_pte_program_size" "<= 3000 B" \
391391
--require "method_allocator_planned" "<= 64 B" \
392392
--require "method_allocator_loaded" "<= 1024 B" \
393-
--require "method_allocator_input" "<= 4 B" \
393+
--require "method_allocator_input" "<= 16 B" \
394394
--require "Total DRAM used" "<= 0.06 KiB"
395395
echo "${TEST_SUITE_NAME}: PASS"
396396
}

examples/arm/executor_runner/arm_executor_runner.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ Error prepare_input_tensors(
410410
"Wrong number of inputs allocated compared to method");
411411
#endif
412412

413-
EValue* input_evalues =
414-
static_cast<EValue*>(allocator.allocate(num_inputs * sizeof(EValue*)));
413+
EValue* input_evalues = allocator.allocateList<EValue>(num_inputs);
415414
ET_CHECK_OR_RETURN_ERROR(
416415
input_evalues != nullptr,
417416
MemoryAllocationFailed,

0 commit comments

Comments
 (0)