From 75b5d6ffc77c1428cd3fa1ad92ac9e31c1c97c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=9F=E6=B0=91?= Date: Tue, 30 Nov 2021 18:24:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Bug=20fixes:=E8=A7=A3=E5=86=B3Add=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=80=80=E5=87=BA=20=E8=B0=83=E7=94=A8Remove=E5=8F=91?= =?UTF-8?q?=E7=94=9FNULL=E6=8C=87=E9=92=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张伟民 --- support/platform/src/pin/pin_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/platform/src/pin/pin_core.c b/support/platform/src/pin/pin_core.c index 6b41ebd7d..86e594d5b 100644 --- a/support/platform/src/pin/pin_core.c +++ b/support/platform/src/pin/pin_core.c @@ -74,7 +74,9 @@ void PinCntlrRemove(struct PinCntlr *cntlr) } (void)PinCntlrListGet(); - DListRemove(&cntlr->list); + if ((cntlr->list.next != NULL) && (cntlr->list.prev != NULL)) { + DListRemove(&cntlr->list); + } PinCntlrListPut(); (void)OsalSpinDestroy(&cntlr->spin); } -- Gitee From f1665082c38b6efe71fd5184b997bf6367f3504d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=9F=E6=B0=91?= Date: Tue, 30 Nov 2021 18:53:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Bug=20fixes:=E8=A7=A3=E5=86=B3strcmp?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=E5=8F=AF=E8=83=BD=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=A9=BA=E6=8C=87=E9=92=88=E5=AF=BC=E8=87=B4=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张伟民 --- support/platform/src/pin/pin_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/support/platform/src/pin/pin_core.c b/support/platform/src/pin/pin_core.c index 86e594d5b..724c609f6 100644 --- a/support/platform/src/pin/pin_core.c +++ b/support/platform/src/pin/pin_core.c @@ -152,6 +152,11 @@ static int32_t GetPinIndex(struct PinCntlr *cntlr, struct PinDesc *desc) { int32_t index, ret; + if (desc->pinName == NULL) { + HDF_LOGE("%s: desc->pinName is NULL!", __func__); + return HDF_ERR_INVALID_PARAM; + } + for (index = 0; index < cntlr->pinCount; index++) { if (cntlr->pins[index].pinName == NULL) { HDF_LOGE("%s: cntlr->pin[index].pinName is NULL!", __func__); -- Gitee From c79fe856377d445256b1b2332678f0644f291940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=9F=E6=B0=91?= Date: Tue, 30 Nov 2021 18:53:36 +0800 Subject: [PATCH 3/3] Bug fixes:Solve the problem that the pinName of strcmp input parameter may be NULL. Signed-off-by: zhangweimin --- support/platform/src/pin/pin_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/support/platform/src/pin/pin_core.c b/support/platform/src/pin/pin_core.c index 86e594d5b..4a8b2ee04 100644 --- a/support/platform/src/pin/pin_core.c +++ b/support/platform/src/pin/pin_core.c @@ -88,6 +88,11 @@ struct PinDesc *PinCntlrGetPinDescByName(const char *pinName) struct PinCntlr *tmp = NULL; int32_t num; + if (pinName == NULL) { + HDF_LOGE("%s: pinName is NULL!", __func__); + return NULL; + } + list = PinCntlrListGet(); DLIST_FOR_EACH_ENTRY_SAFE(cntlr, tmp, list, struct PinCntlr, list) { -- Gitee