fix: codex

1,VFS代码中不修改参数增加const修饰
2,fs_file_mapping.c: 增加安全函数的判空
3,path_cache.c: sizeof改为使用类型
4,fs_syscall.c: 对NULL解引用
5,VnodeLookup:冗余的判空,及不正确的判空

close: I3UMWD
Signed-off-by: yansira <yansira@hotmail.com>
This commit is contained in:
chenwei
2021-06-07 14:12:47 +08:00
parent c39c10c978
commit 101a55d119
8 changed files with 40 additions and 28 deletions

View File

@@ -270,13 +270,11 @@ int SysOpen(const char *path, int oflags, ...)
mode_t mode = DEFAULT_FILE_MODE; /* 0666: File read-write properties. */
char *pathRet = NULL;
if (path == NULL && *path == 0) {
return -EINVAL;
}
ret = UserPathCopy(path, &pathRet);
if (ret != 0) {
return ret;
if (path != NULL) {
ret = UserPathCopy(path, &pathRet);
if (ret != 0) {
goto ERROUT_PATH_FREE;
}
}
procFd = AllocProcessFd();
@@ -310,15 +308,16 @@ int SysOpen(const char *path, int oflags, ...)
return procFd;
ERROUT:
if (pathRet != NULL) {
LOS_MemFree(OS_SYS_MEM_ADDR, pathRet);
}
if (ret >= 0) {
AssociateSystemFd(procFd, ret);
ret = procFd;
} else {
FreeProcessFd(procFd);
}
ERROUT_PATH_FREE:
if (pathRet != NULL) {
LOS_MemFree(OS_SYS_MEM_ADDR, pathRet);
}
return ret;
}