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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user