summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/poll.cc
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2020-01-13 10:14:30 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-13 10:16:07 -0800
commitf54b9c0ee6e02f9c8bf32aa268c9028ff741bf7c (patch)
treeb52e1206fd7e47fc30c2a625f37b44481fabbd85 /test/syscalls/linux/poll.cc
parentbf6429b944aed6de073c62ceb446cfaed5042dbc (diff)
tests: fix errors detected by asan.
PiperOrigin-RevId: 289467083
Diffstat (limited to 'test/syscalls/linux/poll.cc')
-rw-r--r--test/syscalls/linux/poll.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/syscalls/linux/poll.cc b/test/syscalls/linux/poll.cc
index 9e5aa7fd0..c42472474 100644
--- a/test/syscalls/linux/poll.cc
+++ b/test/syscalls/linux/poll.cc
@@ -275,7 +275,8 @@ TEST_F(PollTest, Nfds) {
// Each entry in the 'fds' array refers to the eventfd and polls for
// "writable" events (events=POLLOUT). This essentially guarantees that the
// poll() is a no-op and allows negative testing of the 'nfds' parameter.
- std::vector<struct pollfd> fds(max_fds, {.fd = efd.get(), .events = POLLOUT});
+ std::vector<struct pollfd> fds(max_fds + 1,
+ {.fd = efd.get(), .events = POLLOUT});
// Verify that 'nfds' up to RLIMIT_NOFILE are allowed.
EXPECT_THAT(RetryEINTR(poll)(fds.data(), 1, 1), SyscallSucceedsWithValue(1));