[libc][fix] Fix buffer overrun in initialization of GPU return value

Summary:
The HSA API explicitly states that the size is a count of uint32_t's not
a byte count. This was erroneously being used as a simple memcpy,
causing some weird behaviour. Fix this by correctly passing `1` to
initialize a single integer to zero.
This commit is contained in:
Joseph Huber 2023-09-01 17:21:31 -05:00
parent 65642c7308
commit 701e6f7630

View File

@ -397,7 +397,7 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
hsa_amd_memory_pool_allocate(coarsegrained_pool, sizeof(int),
/*flags=*/0, &dev_ret))
handle_error(err);
hsa_amd_memory_fill(dev_ret, 0, sizeof(int));
hsa_amd_memory_fill(dev_ret, 0, /*count=*/1);
// Allocate finegrained memory for the RPC server and client to share.
uint32_t wavefront_size = 0;