fds pointer not initialized cause dereference error

Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
This commit is contained in:
zhanghu5 2023-06-25 20:08:08 +08:00 committed by Xiang Xiao
parent ce6382cc0c
commit 3fd404a4c5

View File

@ -531,7 +531,7 @@ static int goldfish_pipe_poll(FAR struct file *filp,
mask |= EPOLLERR;
if (mask)
poll_notify(dev->fds, 1, mask);
poll_notify(dev->fds, dev->pipes_capacity, mask);
}
else if (fds->priv != NULL)
{
@ -943,6 +943,13 @@ int goldfish_pipe_register(void *base, int irq)
return -ENOMEM;
}
dev->fds = kmm_calloc(dev->pipes_capacity, sizeof(*dev->fds));
if (!dev->fds)
{
return -ENOMEM;
}
/* We're going to pass two buffers, open_command_params and
* signalled_pipe_buffers, to the host. This means each of those buffers
* needs to be contained in a single physical page. The easiest choice