usrsock_server: fix coverity for recvfrom handle

req->usockid may not be in a valid range when ret less than zero and not -EAGAIN.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2023-08-30 10:04:49 +08:00 committed by Petro Karashchenko
parent 3f927b63b7
commit b30a389459

View File

@ -642,7 +642,7 @@ static int usrsock_rpmsg_recvfrom_handler(FAR struct rpmsg_endpoint *ept,
events, req->head.xid, totlen, iov[i].iov_len);
}
if (retr >= 0 && events == 0)
if (retr >= 0 && (ret > 0 || ret == -EAGAIN) && events == 0)
{
usrsock_rpmsg_poll_setup(&priv->pfds[req->usockid],
priv->pfds[req->usockid].events | POLLIN);