From 82cce2fef5cda979b6517a2b46b37ab77741a642 Mon Sep 17 00:00:00 2001 From: huyx Date: Tue, 2 Jul 2024 20:57:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- framework/core/host/src/hdf_device.c | 4 ++++ framework/support/platform/src/i2c/i2c_if_u.c | 4 ++++ framework/utils/src/hcs_parser/hcs_generate_tree.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/framework/core/host/src/hdf_device.c b/framework/core/host/src/hdf_device.c index e595bab30..b3a264093 100644 --- a/framework/core/host/src/hdf_device.c +++ b/framework/core/host/src/hdf_device.c @@ -67,6 +67,10 @@ static int AcquireNodeDeivceId(struct HdfDevice *device, devid_t *devid) } } + if (*devid == NULL) { + HDF_LOGE("params invalid *devid"); + return HDF_ERR_INVALID_PARAM; + } *devid = MK_DEVID(HOSTID(device->deviceId), DEVICEID(device->deviceId), nodeId); return HDF_SUCCESS; diff --git a/framework/support/platform/src/i2c/i2c_if_u.c b/framework/support/platform/src/i2c/i2c_if_u.c index 77097cfa5..084062d3c 100644 --- a/framework/support/platform/src/i2c/i2c_if_u.c +++ b/framework/support/platform/src/i2c/i2c_if_u.c @@ -71,6 +71,10 @@ static struct I2cHandle *I2cHandleInstance(struct I2cManagerService *manager) static int32_t I2cHandleSbufCheckResize(struct HdfSBuf **sbuf) { + if (**sbuf == NULL) { + HDF_LOGE("params invalid **sbuf"); + return HDF_ERR_INVALID_PARAM; + } struct HdfSBuf *buf = *sbuf; int32_t ret = HDF_SUCCESS; diff --git a/framework/utils/src/hcs_parser/hcs_generate_tree.c b/framework/utils/src/hcs_parser/hcs_generate_tree.c index 0b0aeb6d8..fcef0c78d 100644 --- a/framework/utils/src/hcs_parser/hcs_generate_tree.c +++ b/framework/utils/src/hcs_parser/hcs_generate_tree.c @@ -84,6 +84,10 @@ static bool AddAttrInNode(const char *start, struct DeviceResourceNode *parentNo static int32_t ParseByteCode(const char *treeStart, int32_t offset, char **treeMem, struct TreeStack **treeStack, int32_t *treeLayerOrMemLen) { + if (**treeMem == NULL) { + HDF_LOGE("params invalid **treeMem"); + return HDF_ERR_INVALID_PARAM; + } int32_t termOffset = HcsGetNodeOrAttrLength(treeStart + offset); struct DeviceResourceNode *parentOrCurNode = NULL; struct DeviceResourceNode *newNode = NULL; -- Gitee From c5a5fb649c7884a89c3192f550d51d21b942466d Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 3 Jul 2024 11:24:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- framework/core/host/src/hdf_device.c | 2 +- framework/support/platform/src/i2c/i2c_if_u.c | 4 ++-- framework/utils/src/hcs_parser/hcs_generate_tree.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/core/host/src/hdf_device.c b/framework/core/host/src/hdf_device.c index b3a264093..bf5cbe0a3 100644 --- a/framework/core/host/src/hdf_device.c +++ b/framework/core/host/src/hdf_device.c @@ -67,7 +67,7 @@ static int AcquireNodeDeivceId(struct HdfDevice *device, devid_t *devid) } } - if (*devid == NULL) { + if (devid == NULL) { HDF_LOGE("params invalid *devid"); return HDF_ERR_INVALID_PARAM; } diff --git a/framework/support/platform/src/i2c/i2c_if_u.c b/framework/support/platform/src/i2c/i2c_if_u.c index 084062d3c..eeb0169ff 100644 --- a/framework/support/platform/src/i2c/i2c_if_u.c +++ b/framework/support/platform/src/i2c/i2c_if_u.c @@ -71,8 +71,8 @@ static struct I2cHandle *I2cHandleInstance(struct I2cManagerService *manager) static int32_t I2cHandleSbufCheckResize(struct HdfSBuf **sbuf) { - if (**sbuf == NULL) { - HDF_LOGE("params invalid **sbuf"); + if (sbuf == NULL ) { + HDF_LOGE("params invalid sbuf"); return HDF_ERR_INVALID_PARAM; } struct HdfSBuf *buf = *sbuf; diff --git a/framework/utils/src/hcs_parser/hcs_generate_tree.c b/framework/utils/src/hcs_parser/hcs_generate_tree.c index fcef0c78d..c3afe7831 100644 --- a/framework/utils/src/hcs_parser/hcs_generate_tree.c +++ b/framework/utils/src/hcs_parser/hcs_generate_tree.c @@ -84,8 +84,8 @@ static bool AddAttrInNode(const char *start, struct DeviceResourceNode *parentNo static int32_t ParseByteCode(const char *treeStart, int32_t offset, char **treeMem, struct TreeStack **treeStack, int32_t *treeLayerOrMemLen) { - if (**treeMem == NULL) { - HDF_LOGE("params invalid **treeMem"); + if (treeMem == NULL) { + HDF_LOGE("params invalid treeMem"); return HDF_ERR_INVALID_PARAM; } int32_t termOffset = HcsGetNodeOrAttrLength(treeStart + offset); -- Gitee From 494b77eebc53beabcd16dd09c281db10d71aa7a2 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 3 Jul 2024 11:35:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- framework/support/platform/src/i2c/i2c_if_u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/support/platform/src/i2c/i2c_if_u.c b/framework/support/platform/src/i2c/i2c_if_u.c index eeb0169ff..0e0843225 100644 --- a/framework/support/platform/src/i2c/i2c_if_u.c +++ b/framework/support/platform/src/i2c/i2c_if_u.c @@ -71,7 +71,7 @@ static struct I2cHandle *I2cHandleInstance(struct I2cManagerService *manager) static int32_t I2cHandleSbufCheckResize(struct HdfSBuf **sbuf) { - if (sbuf == NULL ) { + if (sbuf == NULL) { HDF_LOGE("params invalid sbuf"); return HDF_ERR_INVALID_PARAM; } -- Gitee