Skip to content

Commit 54bb3e4

Browse files
cujomalaineykv2019i
authored andcommitted
ipc3: move pointer assignments to after validation
UBSAN is complaining about the pointers being overflown given we haven't checked the parameters. Move it behind the code that protects this to satisfy the sanitizer. Signed-off-by: Curtis Malainey <[email protected]>
1 parent 53adb48 commit 54bb3e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ipc/ipc3/handler.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,6 @@ static int ipc_trace_filter_update(uint32_t header)
904904
int cnt;
905905

906906
packet = ipc->comp_data;
907-
elem = packet->elems;
908-
end = &packet->elems[packet->elem_cnt];
909907

910908
/* validation, packet->hdr.size has already been compared with SOF_IPC_MSG_MAX_SIZE */
911909
if (sizeof(*packet) + sizeof(*elem) * packet->elem_cnt != packet->hdr.size) {
@@ -917,6 +915,9 @@ static int ipc_trace_filter_update(uint32_t header)
917915
tr_info(&ipc_tr, "ipc: trace_filter_update received, size %d elems",
918916
packet->elem_cnt);
919917

918+
elem = packet->elems;
919+
end = &packet->elems[packet->elem_cnt];
920+
920921
/* read each filter set and update selected components trace settings */
921922
while (elem != end) {
922923
next_elem = trace_filter_fill(elem, end, &filter);

0 commit comments

Comments
 (0)