From bd6145d32702cbb842fcec8528cd49f12c20abc8 Mon Sep 17 00:00:00 2001 From: huyx Date: Mon, 5 Aug 2024 10:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- adapter/uhdf2/hdi/src/servstat_listener_stub.cpp | 3 +-- framework/support/posix/src/osal_time.c | 3 ++- interfaces/inner_api/hdi/base/hdi_smq.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adapter/uhdf2/hdi/src/servstat_listener_stub.cpp b/adapter/uhdf2/hdi/src/servstat_listener_stub.cpp index 9eafc8a07..ab4781f01 100644 --- a/adapter/uhdf2/hdi/src/servstat_listener_stub.cpp +++ b/adapter/uhdf2/hdi/src/servstat_listener_stub.cpp @@ -57,8 +57,7 @@ int32_t ServStatListenerStub::ServStatListenerStubOnReceive( const char *info = data.ReadCString(); status.info = (info == nullptr) ? "" : info; - HDF_LOGI("%{public}s call func OnReceive, serviceName: %{public}s, status: %{public}d", - __func__, status.serviceName.c_str(), status.status); + HDF_LOGI("call OnReceive, %{public}s, %{public}d", status.serviceName.c_str(), status.status); OnReceive(status); return HDF_SUCCESS; } diff --git a/framework/support/posix/src/osal_time.c b/framework/support/posix/src/osal_time.c index 67c386a1e..0b3d2a56b 100644 --- a/framework/support/posix/src/osal_time.c +++ b/framework/support/posix/src/osal_time.c @@ -52,7 +52,8 @@ int32_t OsalDiffTime(const OsalTimespec *start, const OsalTimespec *end, OsalTim sec = 1; } - if (end->sec - start->sec - sec < 0 || end->sec > UINT64_MAX - sec - start->sec) { + uint32_t secTime = start->sec + sec; + if (end->sec - secTime < 0 || end->sec > UINT32_MAX - secTime) { HDF_LOGE("%s end time invalid", __func__); return HDF_ERR_INVALID_PARAM; } diff --git a/interfaces/inner_api/hdi/base/hdi_smq.h b/interfaces/inner_api/hdi/base/hdi_smq.h index ecdc37ee7..0c488453c 100644 --- a/interfaces/inner_api/hdi/base/hdi_smq.h +++ b/interfaces/inner_api/hdi/base/hdi_smq.h @@ -401,7 +401,7 @@ bool SharedMemQueue::IsGood() template size_t SharedMemQueue::Align(size_t num, size_t alignSize) { - if ((num + alignSize) < 1 || num > (SIZE_MAX - alignSize) || alignSize > (SIZE_MAX - num)) { + if ((num + alignSize) < 1 || num > (SIZE_MAX - alignSize)) { HDF_LOGE("Invalid parameter num or alignSize"); return 0; } -- Gitee