From d497bf51a6286af7b975dcbe83b0d4f47685cc32 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 5 Mar 2022 11:16:14 -0500 Subject: [PATCH] kernel/wait_for_objects: Fix copy/paste error in poll(). Seems none of the applications I tested yesterday actually used poll(), because it was completely broken by this. The previous code assigned this variable inside a malloc() call, though, which wasn't all that obvious either. --- src/system/kernel/wait_for_objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/wait_for_objects.cpp b/src/system/kernel/wait_for_objects.cpp index 1f2167376e..cd854ed1d8 100644 --- a/src/system/kernel/wait_for_objects.cpp +++ b/src/system/kernel/wait_for_objects.cpp @@ -1043,7 +1043,7 @@ _user_poll(struct pollfd *userfds, int numFDs, bigtime_t timeout, if (!fds.IsValid()) return B_NO_MEMORY; - size_t bytes = 0; + const size_t bytes = numFDs * sizeof(struct pollfd); if (numFDs != 0) { if (userfds == NULL || !IS_USER_ADDRESS(userfds)) return B_BAD_ADDRESS;