From c218583a68089af2f474455b09b22df4154587cc Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Fri, 5 Apr 2024 16:58:49 +0200 Subject: Fix zero init of class members in message handler There are instances of class members not being zero initialized in the message handler. To avoid possible issues with using the class members when they have an intermediate value, the constructors have been updated to zero initialize all the member variables. Change-Id: Ib539410a8f1486f8155272731f5cb7006c22ac7a Signed-off-by: Mikael Olsson --- applications/message_handler_openamp/inference_runner.cpp | 2 +- applications/message_handler_openamp/message_handler.cpp | 2 +- applications/message_handler_openamp/remoteproc.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/applications/message_handler_openamp/inference_runner.cpp b/applications/message_handler_openamp/inference_runner.cpp index bf07819..659d685 100644 --- a/applications/message_handler_openamp/inference_runner.cpp +++ b/applications/message_handler_openamp/inference_runner.cpp @@ -51,7 +51,7 @@ InferenceRunner::InferenceRunner(uint8_t *tensorArena, MessageHandler::InferenceQueue &_inferenceQueue, MessageHandler::ResponseQueue &_responseQueue) : inferenceQueue(_inferenceQueue), - responseQueue(_responseQueue), inference(tensorArena, arenaSize) { + responseQueue(_responseQueue), inference(tensorArena, arenaSize), taskHandle() { BaseType_t ret = xTaskCreate(inferenceTask, "inferenceTask", 8 * 1024, this, 4, &taskHandle); if (ret != pdPASS) { LOG_ERR("Failed to create inference task"); diff --git a/applications/message_handler_openamp/message_handler.cpp b/applications/message_handler_openamp/message_handler.cpp index fa93a48..dfed04c 100644 --- a/applications/message_handler_openamp/message_handler.cpp +++ b/applications/message_handler_openamp/message_handler.cpp @@ -109,7 +109,7 @@ bool getIndexedNetwork(const uint32_t index, void *&data, size_t &size) { *****************************************************************************/ MessageHandler::MessageHandler(RProc &_rproc, const char *const _name) : - Rpmsg(_rproc, _name), capabilities(getCapabilities()) { + Rpmsg(_rproc, _name), inferenceQueue(), responseQueue(), capabilities(getCapabilities()), taskHandle() { BaseType_t ret = xTaskCreate(responseTask, "responseTask", 1024, this, 3, &taskHandle); if (ret != pdPASS) { LOG_ERR("Failed to create response task"); diff --git a/applications/message_handler_openamp/remoteproc.cpp b/applications/message_handler_openamp/remoteproc.cpp index c2db93a..48dd4e8 100644 --- a/applications/message_handler_openamp/remoteproc.cpp +++ b/applications/message_handler_openamp/remoteproc.cpp @@ -44,7 +44,8 @@ void setupRProcMem(remoteproc &rproc, *****************************************************************************/ RProc::RProc(Mailbox::Mailbox &_mailbox, resource_table &table, size_t tableSize) : - mailbox(_mailbox), ops({}), vdev(nullptr), mems(), regions(), notifySemaphore(xSemaphoreCreateBinary()) { + mailbox(_mailbox), ops({}), vdev(nullptr), rsc_mem(), rsc_region(), mems(), regions(), + notifySemaphore(xSemaphoreCreateBinary()), notifyHandle() { ops.init = init; // initialize the remoteproc instance ops.remove = remove; // remove the remoteproc instance ops.handle_rsc = handle_rsc; // handle the vendor specific resource -- cgit v1.2.1