diff --git a/model/usb/include/usb_pnp_manager.h b/model/usb/include/usb_pnp_manager.h index 2a7cb5b4..9c5a2579 100644 --- a/model/usb/include/usb_pnp_manager.h +++ b/model/usb/include/usb_pnp_manager.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. */ #ifndef USB_PNP_MANAGE_H diff --git a/model/usb/src/usb_ddk_pnp_loader.c b/model/usb/src/usb_ddk_pnp_loader.c index 646f7ba9..cc763fd7 100644 --- a/model/usb/src/usb_ddk_pnp_loader.c +++ b/model/usb/src/usb_ddk_pnp_loader.c @@ -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) { diff --git a/test/unittest/model/usb/device/include/usb_device_lite_cdcacm_test.h b/test/unittest/model/usb/device/include/usb_device_lite_cdcacm_test.h index ec2b60d8..2ea436d0 100644 --- a/test/unittest/model/usb/device/include/usb_device_lite_cdcacm_test.h +++ b/test/unittest/model/usb/device/include/usb_device_lite_cdcacm_test.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. */ #ifndef USB_DEVICE_LITE_CDCACM_TEST_H diff --git a/test/unittest/model/usb/device/src/usb_device_lite_cdcacm_test.c b/test/unittest/model/usb/device/src/usb_device_lite_cdcacm_test.c index 191340cb..4743b0a9 100644 --- a/test/unittest/model/usb/device/src/usb_device_lite_cdcacm_test.c +++ b/test/unittest/model/usb/device/src/usb_device_lite_cdcacm_test.c @@ -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" diff --git a/test/unittest/model/usb/device/src/usb_device_lite_sdk_if_test.c b/test/unittest/model/usb/device/src/usb_device_lite_sdk_if_test.c index 82a24f96..1b06415c 100644 --- a/test/unittest/model/usb/device/src/usb_device_lite_sdk_if_test.c +++ b/test/unittest/model/usb/device/src/usb_device_lite_sdk_if_test.c @@ -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" diff --git a/test/unittest/model/usb/device/src/usb_device_lite_sdk_io_test.c b/test/unittest/model/usb/device/src/usb_device_lite_sdk_io_test.c index 8c8a24cb..fbf037c0 100644 --- a/test/unittest/model/usb/device/src/usb_device_lite_sdk_io_test.c +++ b/test/unittest/model/usb/device/src/usb_device_lite_sdk_io_test.c @@ -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