fix: 内源代码检视问题

【背景】内源代码检视问题

【修改方案】
1,按检视意见,进行资源泄露等问题的修改

【影响】
对现有的产品编译不会有影响。

re #I4WV56
Signed-off-by: wangchen <wangchen64@huawei.com>
This commit is contained in:
wangchen 2022-03-10 07:47:56 +00:00
parent 0fb16312dc
commit 2f1ed39bc1
2 changed files with 9 additions and 2 deletions

View File

@ -242,6 +242,11 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
return ret;
}
if (ev == NULL) {
set_errno(EINVAL);
return -1;
}
switch (op) {
case EPOLL_CTL_ADD:
ret = CheckFdExist(epHead, fd);
@ -304,7 +309,7 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout
return -1;
}
if (maxevents <= 0) {
if ((maxevents <= 0) || (evs == NULL)) {
set_errno(EINVAL);
return -1;
}

View File

@ -2570,7 +2570,9 @@ int SysPselect6(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
CPY_FROM_USER(exceptfds);
DUP_FROM_USER(timeout, sizeof(struct timeval));
((struct timeval *)timeout)->tv_usec = timeout->tv_nsec / 1000; /* 1000, convert ns to us */
if (timeout != NULL) {
((struct timeval *)timeout)->tv_usec = timeout->tv_nsec / 1000; /* 1000, convert ns to us */
}
if (data != NULL) {
retVal = LOS_ArchCopyFromUser(&(setl.sig[0]), (int *)((UINTPTR)data[0]), sizeof(sigset_t));