fix usb security function verification

Signed-off-by: wu <wuzhimin8@huawei.com>
This commit is contained in:
wu
2022-03-11 19:38:00 -08:00
parent 3958d74863
commit 685a428f3f
6 changed files with 41 additions and 61 deletions
+4 -11
View File
@@ -1,16 +1,9 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * HDF is dual licensed: you can use it either under the terms of
* * the GPL, or the BSD license, at your option.
* Unless required by applicable law or agreed to in writing, software * See the LICENSE file in the root of this repository for complete details.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#ifndef USB_PNP_MANAGE_H #ifndef USB_PNP_MANAGE_H
+19 -6
View File
@@ -720,9 +720,13 @@ static int32_t UsbDdkPnpLoaderDeviceListAdd(const struct UsbPnpNotifyMatchInfoTa
deviceTableListTemp->devNum = info->devNum; deviceTableListTemp->devNum = info->devNum;
deviceTableListTemp->busNum = info->busNum; deviceTableListTemp->busNum = info->busNum;
deviceTableListTemp->interfaceLength = idTable->interfaceLength; deviceTableListTemp->interfaceLength = idTable->interfaceLength;
memcpy_s(deviceTableListTemp->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES, \ ret = memcpy_s(deviceTableListTemp->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES, \
idTable->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES); idTable->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s:%{public}d memcpy_s failed", __func__, __LINE__);
return ret;
}
DListInsertTail(&deviceTableListTemp->list, &g_usbPnpDeviceTableListHead); DListInsertTail(&deviceTableListTemp->list, &g_usbPnpDeviceTableListHead);
ret = HDF_SUCCESS; ret = HDF_SUCCESS;
@@ -770,8 +774,7 @@ static int32_t UsbDdkPnpLoaderrAddPnpDevice(struct HdfDeviceObject *usbPnpManage
deviceListTable = UsbDdkPnpLoaderAddInterface(infoTable, idTable); deviceListTable = UsbDdkPnpLoaderAddInterface(infoTable, idTable);
if ((deviceListTable != NULL) && (deviceListTable->status != USB_PNP_REMOVE_STATUS)) { if ((deviceListTable != NULL) && (deviceListTable->status != USB_PNP_REMOVE_STATUS)) {
HDF_LOGI("%s:%d %s-%s is already exist!", HDF_LOGI("%s:%d %s-%s is already exist!", __func__, __LINE__, idTable->moduleName, idTable->serviceName);
__func__, __LINE__, idTable->moduleName, idTable->serviceName);
return HDF_SUCCESS; return HDF_SUCCESS;
} }
@@ -780,8 +783,13 @@ static int32_t UsbDdkPnpLoaderrAddPnpDevice(struct HdfDeviceObject *usbPnpManage
serviceInfo.devNum = infoTable->devNum; serviceInfo.devNum = infoTable->devNum;
serviceInfo.busNum = infoTable->busNum; serviceInfo.busNum = infoTable->busNum;
serviceInfo.interfaceLength = idTable->interfaceLength; serviceInfo.interfaceLength = idTable->interfaceLength;
memcpy_s(serviceInfo.interfaceNumber, USB_PNP_INFO_MAX_INTERFACES, \ ret = memcpy_s(serviceInfo.interfaceNumber, USB_PNP_INFO_MAX_INTERFACES, \
idTable->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES); idTable->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s:%{public}d memcpy_s failed", __func__, __LINE__);
return ret;
}
pnpData = UsbDdkPnpLoaderBufCreate(idTable->moduleName, idTable->serviceName, pnpData = UsbDdkPnpLoaderBufCreate(idTable->moduleName, idTable->serviceName,
idTable->deviceMatchAttr, serviceInfo); idTable->deviceMatchAttr, serviceInfo);
if (pnpData == NULL) { if (pnpData == NULL) {
@@ -854,8 +862,13 @@ static int32_t UsbDdkPnpLoaderRemoveHandle(struct HdfDeviceObject *usbPnpManager
serviceInfo.devNum = deviceListTablePos->devNum; serviceInfo.devNum = deviceListTablePos->devNum;
serviceInfo.busNum = deviceListTablePos->busNum; serviceInfo.busNum = deviceListTablePos->busNum;
serviceInfo.interfaceLength = deviceListTablePos->interfaceLength; serviceInfo.interfaceLength = deviceListTablePos->interfaceLength;
memcpy_s(serviceInfo.interfaceNumber, USB_PNP_INFO_MAX_INTERFACES, \ ret = memcpy_s(serviceInfo.interfaceNumber, USB_PNP_INFO_MAX_INTERFACES, \
deviceListTablePos->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES); deviceListTablePos->interfaceNumber, USB_PNP_INFO_MAX_INTERFACES);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s:%{public}d memcpy_s failed", __func__, __LINE__);
return ret;
}
pnpData = UsbDdkPnpLoaderBufCreate(deviceListTablePos->moduleName, deviceListTablePos->serviceName, \ pnpData = UsbDdkPnpLoaderBufCreate(deviceListTablePos->moduleName, deviceListTablePos->serviceName, \
deviceListTablePos->deviceMatchAttr, serviceInfo); deviceListTablePos->deviceMatchAttr, serviceInfo);
if (pnpData == NULL) { if (pnpData == NULL) {
@@ -1,16 +1,9 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * HDF is dual licensed: you can use it either under the terms of
* * the GPL, or the BSD license, at your option.
* Unless required by applicable law or agreed to in writing, software * See the LICENSE file in the root of this repository for complete details.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#ifndef USB_DEVICE_LITE_CDCACM_TEST_H #ifndef USB_DEVICE_LITE_CDCACM_TEST_H
@@ -1,17 +1,11 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * HDF is dual licensed: you can use it either under the terms of
* * the GPL, or the BSD license, at your option.
* Unless required by applicable law or agreed to in writing, software * See the LICENSE file in the root of this repository for complete details.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include "usb_device_lite_cdcacm_test.h" #include "usb_device_lite_cdcacm_test.h"
#include "usbfn_dev_mgr.h" #include "usbfn_dev_mgr.h"
#include "usbfn_cfg_mgr.h" #include "usbfn_cfg_mgr.h"
@@ -1,16 +1,9 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * HDF is dual licensed: you can use it either under the terms of
* * the GPL, or the BSD license, at your option.
* Unless required by applicable law or agreed to in writing, software * See the LICENSE file in the root of this repository for complete details.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include "usb_device_lite_cdcacm_test.h" #include "usb_device_lite_cdcacm_test.h"
@@ -1,17 +1,11 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * HDF is dual licensed: you can use it either under the terms of
* * the GPL, or the BSD license, at your option.
* Unless required by applicable law or agreed to in writing, software * See the LICENSE file in the root of this repository for complete details.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include "usb_device_lite_cdcacm_test.h" #include "usb_device_lite_cdcacm_test.h"
#define HDF_LOG_TAG usb_device_sdk_test #define HDF_LOG_TAG usb_device_sdk_test