mirror of
https://github.com/openharmony/drivers_adapter_khdf_linux.git
synced 2026-07-19 16:43:55 -04:00
fix:Modify function security issues in mipidsi
Signed-off-by: jiaziyangmain <jiaziyang1@huawei.com>
This commit is contained in:
@@ -336,13 +336,11 @@ static int32_t MipiDsiDevSetCfg(struct MipiDsiCntlr *cntlr, struct MipiCfg *arg)
|
||||
HDF_LOGE("%s: [CopyFromUser] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else { /* kernel space */
|
||||
if (memcpy_s(temp, size, arg, size) != EOK) {
|
||||
OsalMemFree(temp);
|
||||
temp = NULL;
|
||||
HDF_LOGE("%s: [memcpy_s] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else {
|
||||
OsalMemFree(temp);
|
||||
temp = NULL;
|
||||
HDF_LOGE("%s: illegal user space address.", __func__);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
ret = MipiDsiCntlrSetCfg(cntlr, temp);
|
||||
@@ -387,13 +385,11 @@ int32_t MipiDsiDevSetCmd(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *arg)
|
||||
HDF_LOGE("%s: [CopyFromUser] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else { /* kernel space */
|
||||
if (memcpy_s(temp, size, arg, size) != EOK) {
|
||||
OsalMemFree(temp);
|
||||
temp = NULL;
|
||||
HDF_LOGE("%s: [memcpy_s] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else {
|
||||
OsalMemFree(temp);
|
||||
temp = NULL;
|
||||
HDF_LOGE("%s: illegal user space address.", __func__);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
ret = MipiDsiCntlrTx(cntlr, temp);
|
||||
@@ -414,11 +410,9 @@ int32_t MipiDsiDevCmdCopyFromUser(GetDsiCmdDescTag *arg, GetDsiCmdDescTag *temp,
|
||||
HDF_LOGE("%s: [CopyFromUser] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else { /* kernel space */
|
||||
if (memcpy_s(temp, *size, arg, *size) != EOK) {
|
||||
HDF_LOGE("%s: [memcpy_s] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else {
|
||||
HDF_LOGE("%s: illegal user space address.", __func__);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
@@ -434,11 +428,9 @@ int32_t MipiDsiDevCmdCopyToUser(GetDsiCmdDescTag *arg, GetDsiCmdDescTag *temp, u
|
||||
HDF_LOGE("%s: [CopyToUser] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else { /* kernel space */
|
||||
if (memcpy_s(arg, *size, temp, *size) != EOK) {
|
||||
HDF_LOGE("%s: [memcpy_s] failed.", __func__);
|
||||
return HDF_ERR_IO;
|
||||
}
|
||||
} else {
|
||||
HDF_LOGE("%s: illegal user space address.", __func__);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user