!780 [OpenHarmony-3.1-Release][drivers_framework] fix usb security function verification

Merge pull request !780 from wuzhimin/cherry-pick-1647229193
This commit is contained in:
openharmony_ci
2022-03-14 08:15:29 +00:00
committed by Gitee
6 changed files with 41 additions and 61 deletions
+4 -11
View File
@@ -1,16 +1,9 @@
/*
* Copyright (c) 2021 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
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
* HDF is dual licensed: you can use it either under the terms of
* the GPL, or the BSD license, at your option.
* See the LICENSE file in the root of this repository for complete details.
*/
#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->busNum = info->busNum;
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);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s:%{public}d memcpy_s failed", __func__, __LINE__);
return ret;
}
DListInsertTail(&deviceTableListTemp->list, &g_usbPnpDeviceTableListHead);
ret = HDF_SUCCESS;
@@ -770,8 +774,7 @@ static int32_t UsbDdkPnpLoaderrAddPnpDevice(struct HdfDeviceObject *usbPnpManage
deviceListTable = UsbDdkPnpLoaderAddInterface(infoTable, idTable);
if ((deviceListTable != NULL) && (deviceListTable->status != USB_PNP_REMOVE_STATUS)) {
HDF_LOGI("%s:%d %s-%s is already exist!",
__func__, __LINE__, idTable->moduleName, idTable->serviceName);
HDF_LOGI("%s:%d %s-%s is already exist!", __func__, __LINE__, idTable->moduleName, idTable->serviceName);
return HDF_SUCCESS;
}
@@ -780,8 +783,13 @@ static int32_t UsbDdkPnpLoaderrAddPnpDevice(struct HdfDeviceObject *usbPnpManage
serviceInfo.devNum = infoTable->devNum;
serviceInfo.busNum = infoTable->busNum;
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);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s:%{public}d memcpy_s failed", __func__, __LINE__);
return ret;
}
pnpData = UsbDdkPnpLoaderBufCreate(idTable->moduleName, idTable->serviceName,
idTable->deviceMatchAttr, serviceInfo);
if (pnpData == NULL) {
@@ -854,8 +862,13 @@ static int32_t UsbDdkPnpLoaderRemoveHandle(struct HdfDeviceObject *usbPnpManager
serviceInfo.devNum = deviceListTablePos->devNum;
serviceInfo.busNum = deviceListTablePos->busNum;
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);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s:%{public}d memcpy_s failed", __func__, __LINE__);
return ret;
}
pnpData = UsbDdkPnpLoaderBufCreate(deviceListTablePos->moduleName, deviceListTablePos->serviceName, \
deviceListTablePos->deviceMatchAttr, serviceInfo);
if (pnpData == NULL) {
@@ -1,16 +1,9 @@
/*
* Copyright (c) 2021 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
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
* HDF is dual licensed: you can use it either under the terms of
* the GPL, or the BSD license, at your option.
* See the LICENSE file in the root of this repository for complete details.
*/
#ifndef USB_DEVICE_LITE_CDCACM_TEST_H
@@ -1,17 +1,11 @@
/*
* Copyright (c) 2021 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
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
* HDF is dual licensed: you can use it either under the terms of
* the GPL, or the BSD license, at your option.
* See the LICENSE file in the root of this repository for complete details.
*/
#include "usb_device_lite_cdcacm_test.h"
#include "usbfn_dev_mgr.h"
#include "usbfn_cfg_mgr.h"
@@ -1,16 +1,9 @@
/*
* Copyright (c) 2021 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
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
* HDF is dual licensed: you can use it either under the terms of
* the GPL, or the BSD license, at your option.
* See the LICENSE file in the root of this repository for complete details.
*/
#include "usb_device_lite_cdcacm_test.h"
@@ -1,17 +1,11 @@
/*
* Copyright (c) 2021 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
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
* HDF is dual licensed: you can use it either under the terms of
* the GPL, or the BSD license, at your option.
* See the LICENSE file in the root of this repository for complete details.
*/
#include "usb_device_lite_cdcacm_test.h"
#define HDF_LOG_TAG usb_device_sdk_test