From 4833ea3e9474d02ad87f3c0b255b248de99ce870 Mon Sep 17 00:00:00 2001 From: y30015170 <1169998606@qq.com> Date: Mon, 18 Aug 2025 20:06:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Description:=20=E4=BF=A1=E5=8F=B7=E9=87=8F?= =?UTF-8?q?=E6=A8=A1=E5=9D=97OsSemPostUnsafe=E5=87=BD=E6=95=B0=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E4=BA=8C=E5=80=BC=E4=BF=A1=E5=8F=B7=E9=87=8F=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=97=AE=E9=A2=98=20IssueNo:=20https://gitee.com/open?= =?UTF-8?q?harmony/kernel=5Fliteos=5Fa/issues/ICMANI=20Feature=20or=20Bugf?= =?UTF-8?q?ix:=20Bugfix=09~=20Binary=20Source:=20No=20Signed-off-by:=20y30?= =?UTF-8?q?015170=20<1169998606@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/base/ipc/los_sem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/base/ipc/los_sem.c b/kernel/base/ipc/los_sem.c index 31d484a1..672fab3d 100644 --- a/kernel/base/ipc/los_sem.c +++ b/kernel/base/ipc/los_sem.c @@ -246,7 +246,8 @@ LITE_OS_SEC_TEXT UINT32 OsSemPostUnsafe(UINT32 semHandle, BOOL *needSched) /* Update the operate time, no matter the actual Post success or not */ OsSemDbgTimeUpdateHook(semHandle); - if (semPosted->semCount == OS_SEM_COUNT_MAX) { + if ((semPosted->maxSemCount > 1 && semPosted->semCount == OS_SEM_COUNT_MAX) || + (semPosted->maxSemCount <= 1 && semPosted->semCount == OS_SEM_BINARY_COUNT_MAX)) { return LOS_ERRNO_SEM_OVERFLOW; } if (!LOS_ListEmpty(&semPosted->semList)) { -- Gitee From b7e6d6780ecf22492daeb1859fb551f7842ef2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BA=9E=E6=BA=90?= <1169998606@qq.com> Date: Mon, 18 Aug 2025 12:49:27 +0000 Subject: [PATCH 2/4] update kernel/base/ipc/los_sem.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨庞源 <1169998606@qq.com> --- kernel/base/ipc/los_sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/base/ipc/los_sem.c b/kernel/base/ipc/los_sem.c index 672fab3d..69308dd5 100644 --- a/kernel/base/ipc/los_sem.c +++ b/kernel/base/ipc/los_sem.c @@ -246,7 +246,7 @@ LITE_OS_SEC_TEXT UINT32 OsSemPostUnsafe(UINT32 semHandle, BOOL *needSched) /* Update the operate time, no matter the actual Post success or not */ OsSemDbgTimeUpdateHook(semHandle); - if ((semPosted->maxSemCount > 1 && semPosted->semCount == OS_SEM_COUNT_MAX) || + if ((semPosted->maxSemCount > 1 && semPosted->semCount == OS_SEM_COUNT_MAX) || (semPosted->maxSemCount <= 1 && semPosted->semCount == OS_SEM_BINARY_COUNT_MAX)) { return LOS_ERRNO_SEM_OVERFLOW; } -- Gitee From a8b2b408ae4af0b43aec3dcc22c86a2f484209a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BA=9E=E6=BA=90?= <1169998606@qq.com> Date: Tue, 19 Aug 2025 01:37:35 +0000 Subject: [PATCH 3/4] update kernel/base/ipc/los_sem.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨庞源 <1169998606@qq.com> --- kernel/base/ipc/los_sem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/base/ipc/los_sem.c b/kernel/base/ipc/los_sem.c index 69308dd5..d5ca576c 100644 --- a/kernel/base/ipc/los_sem.c +++ b/kernel/base/ipc/los_sem.c @@ -246,8 +246,7 @@ LITE_OS_SEC_TEXT UINT32 OsSemPostUnsafe(UINT32 semHandle, BOOL *needSched) /* Update the operate time, no matter the actual Post success or not */ OsSemDbgTimeUpdateHook(semHandle); - if ((semPosted->maxSemCount > 1 && semPosted->semCount == OS_SEM_COUNT_MAX) || - (semPosted->maxSemCount <= 1 && semPosted->semCount == OS_SEM_BINARY_COUNT_MAX)) { + if (semPosted->maxSemCount == semPosted->semCount) { return LOS_ERRNO_SEM_OVERFLOW; } if (!LOS_ListEmpty(&semPosted->semList)) { -- Gitee From 0c31ab3a14dcd6a59a28a750244974adebc0781a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BA=9E=E6=BA=90?= <1169998606@qq.com> Date: Tue, 19 Aug 2025 01:38:47 +0000 Subject: [PATCH 4/4] update kernel/base/ipc/los_sem.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨庞源 <1169998606@qq.com> --- kernel/base/ipc/los_sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/base/ipc/los_sem.c b/kernel/base/ipc/los_sem.c index d5ca576c..fea68fca 100644 --- a/kernel/base/ipc/los_sem.c +++ b/kernel/base/ipc/los_sem.c @@ -246,7 +246,7 @@ LITE_OS_SEC_TEXT UINT32 OsSemPostUnsafe(UINT32 semHandle, BOOL *needSched) /* Update the operate time, no matter the actual Post success or not */ OsSemDbgTimeUpdateHook(semHandle); - if (semPosted->maxSemCount == semPosted->semCount) { + if (semPosted->semCount == semPosted->maxSemCount) { return LOS_ERRNO_SEM_OVERFLOW; } if (!LOS_ListEmpty(&semPosted->semList)) { -- Gitee