From 1939c35ca76252752107b4d9f86bd8577935ef7e Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Fri, 22 Dec 2023 14:23:52 +0530 Subject: [PATCH] [ESP32] fix the unsafe access to chip stack in lock-app (#31171) --- examples/lock-app/esp32/main/AppTask.cpp | 6 +++--- examples/lock-app/esp32/main/include/AppTask.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/lock-app/esp32/main/AppTask.cpp b/examples/lock-app/esp32/main/AppTask.cpp index 8b251a305e809c..52650e5c2d2652 100644 --- a/examples/lock-app/esp32/main/AppTask.cpp +++ b/examples/lock-app/esp32/main/AppTask.cpp @@ -99,7 +99,7 @@ CHIP_ERROR AppTask::Init() sLockLED.Set(!BoltLockMgr().IsUnlocked()); - chip::DeviceLayer::SystemLayer().ScheduleWork(UpdateClusterState, nullptr); + chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast(nullptr)); ConfigurationMgr().LogDeviceConfig(); @@ -424,7 +424,7 @@ void AppTask::ActionCompleted(BoltLockManager::Action_t aAction) } if (sAppTask.mSyncClusterToButtonAction) { - chip::DeviceLayer::SystemLayer().ScheduleWork(UpdateClusterState, nullptr); + chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast(nullptr)); sAppTask.mSyncClusterToButtonAction = false; } } @@ -463,7 +463,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } /* if unlocked then it locked it first*/ -void AppTask::UpdateClusterState(chip::System::Layer *, void * context) +void AppTask::UpdateClusterState(intptr_t context) { uint8_t newValue = !BoltLockMgr().IsUnlocked(); diff --git a/examples/lock-app/esp32/main/include/AppTask.h b/examples/lock-app/esp32/main/include/AppTask.h index 7a1aad3e221800..3c32cb8704aa0e 100644 --- a/examples/lock-app/esp32/main/include/AppTask.h +++ b/examples/lock-app/esp32/main/include/AppTask.h @@ -66,7 +66,7 @@ class AppTask static void LockActionEventHandler(AppEvent * aEvent); static void TimerEventHandler(TimerHandle_t xTimer); - static void UpdateClusterState(chip::System::Layer *, void * context); + static void UpdateClusterState(intptr_t context); void StartTimer(uint32_t aTimeoutMs);