Browse Source

fix use of uninitialized dummy_fut in aio_suspend

aio_suspend waits on a dummy futex in the corner case when the array of
requests contains NULL pointers only. But the value of this futex was
left uninitialized, so if it happens to be non-zero, aio_suspend
degrades to spinning instead of blocking.
Alexey Izbyshev 2 years ago
parent
commit
26c76a908b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/aio/aio_suspend.c

+ 1 - 1
src/aio/aio_suspend.c

@@ -9,7 +9,7 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec
 {
 {
 	int i, tid = 0, ret, expect = 0;
 	int i, tid = 0, ret, expect = 0;
 	struct timespec at;
 	struct timespec at;
-	volatile int dummy_fut, *pfut;
+	volatile int dummy_fut = 0, *pfut;
 	int nzcnt = 0;
 	int nzcnt = 0;
 	const struct aiocb *cb = 0;
 	const struct aiocb *cb = 0;