From 4c3eeb417ee28249061be9d00ff9522f59cedddb Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 13 Jul 2023 18:24:14 +0000 Subject: [PATCH] Use a 64-bit instance of 0x1 when creating the event bitmask. Comments on ag/24025770 suggest that the bit shift will lead to undefined behavior for event codes greater than 31. Bug: 290318208 Test: atest VtsHalWifiNanIfaceTargetTest # manually set some of the expected # events codes to > 31 to verify that # the bit shift works as expected Change-Id: I09e11dac8acf90baf047e24cebe1d01970b1dc8a --- wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp index 95bcec7029..738e72cf00 100644 --- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -123,7 +123,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { // Used as a mechanism to inform the test about data/event callbacks. inline void notify(CallbackType callbackType) { std::unique_lock lock(mtx_); - callback_event_bitmap_ |= (0x1 << callbackType); + callback_event_bitmap_ |= (UINT64_C(0x1) << callbackType); cv_.notify_one(); } @@ -143,7 +143,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { } inline bool receivedCallback(CallbackType waitForCallbackType) { - return callback_event_bitmap_ & (0x1 << waitForCallbackType); + return callback_event_bitmap_ & (UINT64_C(0x1) << waitForCallbackType); } class WifiNanIfaceEventCallback : public BnWifiNanIfaceEventCallback {