From: kai.kang@windriver.com Date: Thu, 8 Nov 2018 17:33:24 +0800 Subject: [LTP] [PATCH] msgstress04: make sure not pass IPC_PRIVATE to msgget Message-ID: <20181108093324.14028-1-kai.kang@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it From: Kai Kang It fails to run case msgstress04: $ ./msgstress04 -n 1 -c 1 -l 1 It only inits the first MSGMNI members of keyarray. So if argument off of function dotest_iteration is greater than MSGMNI, the argument key passed to function dotest() will be IPC_PRIVATE(0) which will finally pass to syscall msgget(), then cause case fails. Make sure get the value for key from the initialized members of keyarray. Signed-off-by: Kai Kang --- testcases/kernel/syscalls/ipc/msgstress/msgstress04.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c index 18fad4fbd..a357ce59a 100644 --- a/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c +++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c @@ -198,7 +198,7 @@ static void dotest_iteration(int off) memset(pidarray, 0, sizeof(pidarray)); for (i = 0; i < nprocs; i++) { - key = keyarray[off + i]; + key = keyarray[(off + i) % MSGMNI]; if ((pid = FORK_OR_VFORK()) < 0) tst_brkm(TFAIL, cleanup, -- 2.17.0