tools/probe: Fix realloc condition

The allocated packet should accommodate the header, the data, and the
checksum. The header size was missing from the condition from the
beginning, even if its there in realloc parameter. The bug should be
harmless waste of cycles thou.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
This commit is contained in:
Jyri Sarha 2022-09-27 00:22:16 +03:00 committed by Liam Girdwood
parent 548de64551
commit 29af2df766
1 changed files with 1 additions and 1 deletions

View File

@ -195,7 +195,7 @@ int process_sync(struct probe_data_packet **packet, uint8_t **w_ptr, uint32_t *t
/* request to copy data_size from probe packet and 64-bit checksum */
*total_data_to_copy = (*packet)->data_size_bytes + sizeof(uint64_t);
if (*total_data_to_copy > PACKET_MAX_SIZE) {
if (sizeof(struct probe_data_packet) + *total_data_to_copy > PACKET_MAX_SIZE) {
temp_packet = realloc(packet,
sizeof(struct probe_data_packet) + *total_data_to_copy);
if (!temp_packet)