From 2121e2a087e479f680efc7d375fd9caac4976513 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Fri, 10 Jan 2025 09:44:43 +0800 Subject: [PATCH] =?UTF-8?q?usb=E6=A8=A1=E5=9D=97crash=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- usb/ddk/device/src/usbfn_io_mgr.c | 4 ++-- usb/gadget/function/mtp/src/usbfn_mtp_impl.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usb/ddk/device/src/usbfn_io_mgr.c b/usb/ddk/device/src/usbfn_io_mgr.c index 730a3fb14..ddb416e64 100644 --- a/usb/ddk/device/src/usbfn_io_mgr.c +++ b/usb/ddk/device/src/usbfn_io_mgr.c @@ -95,8 +95,8 @@ struct UsbFnRequest *UsbFnIoMgrRequestAlloc(struct UsbHandleMgr *handle, uint8_t return NULL; } uint8_t *mapAddr = fnOps->mapAddr(ep, len); - if (mapAddr == NULL) { - HDF_LOGE("%{public}s:%{public}d mapAddr failed", __func__, __LINE__); + if (mapAddr == NULL || mapAddr == (uint8_t *)-1) { + HDF_LOGE("%{public}s:%{public}d mapAddr %{public}d to %{public}p failed", __func__, __LINE__, ep, mapAddr); return NULL; } diff --git a/usb/gadget/function/mtp/src/usbfn_mtp_impl.cpp b/usb/gadget/function/mtp/src/usbfn_mtp_impl.cpp index 097a1667c..175e3dcf0 100755 --- a/usb/gadget/function/mtp/src/usbfn_mtp_impl.cpp +++ b/usb/gadget/function/mtp/src/usbfn_mtp_impl.cpp @@ -1221,7 +1221,7 @@ int32_t UsbfnMtpImpl::UsbMtpPortRxPush(struct UsbMtpPort *mtpPort, struct UsbFnR sem_post(&asyncReq_); return HDF_ERR_IO; } - if (writeToFile) { + if (writeToFile && mtpDev->asyncRecvWriteTempContent) { uint8_t *bufOff = mtpDev->asyncRecvWriteTempContent + mtpDev->asyncRecvWriteTempCount; if (memcpy_s(bufOff, req->actual, req->buf, req->actual) != EOK) { HDF_LOGE("%{public}s: memcpy_s failed", __func__); -- Gitee