Skip to contentSkip to conversation

mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

PATCH New Han Pingtian 2 participants 5 messages Feb 24, 2016 – Feb 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

Only when WIFEXITED() returned true that WEXITSTATUS() can return a meanful result. So we should check WIFEXITED() first.

---
 testcases/kernel/mem/lib/mem.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
testcases/kernel/mem/lib/mem.c +8 -4
index cedcf32..8327998 100644
@@ -150,12 +150,16 @@ void oom(int testcase, int lite, int retcode, int allow_sigkill)
 				WTERMSIG(status),
 				tst_strsig(WTERMSIG(status)));
 		}
-	} else	if (WIFEXITED(status) && WEXITSTATUS(status) == retcode) {
-		tst_resm(TPASS, "victim retcode: (%d) %s",
+	} else if (WIFEXITED(status)) {
+		if (WEXITSTATUS(status) == retcode) {
+			tst_resm(TPASS, "victim retcode: (%d) %s",
 				retcode, strerror(retcode));
-	} else {
-		tst_resm(TFAIL, "victim unexpectedly ended with retcode: %d, "
+		} else {
+			tst_resm(TFAIL, "victim unexpectedly ended with retcode: %d, "
 				"expected: %d", WEXITSTATUS(status), retcode);
+		}
+	} else {
+		tst_resm(TFAIL, "victim unexpectedly ended");
 	}
 }
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

----- Original Message -----

Quoted 9 lines

From: "Han Pingtian" <[email protected]>
To: [email protected]
Sent: Wednesday, 24 February, 2016 11:19:14 AM
Subject: [LTP] [PATCH] mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

Only when WIFEXITED() returned true that WEXITSTATUS() can return a meanful result. So we should check WIFEXITED() first.

Looks good to me.

Quoted 17 lines
---
 testcases/kernel/mem/lib/mem.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
testcases/kernel/mem/lib/mem.c +2 -2
index cedcf32..8327998 100644
@@ -150,12 +150,16 @@ void oom(int testcase, int lite, int retcode, int
 allow_sigkill)
 				WTERMSIG(status),
 				tst_strsig(WTERMSIG(status)));
 		}
-	} else	if (WIFEXITED(status) && WEXITSTATUS(status) == retcode) {
-		tst_resm(TPASS, "victim retcode: (%d) %s",
+	} else if (WIFEXITED(status)) {
+		if (WEXITSTATUS(status) == retcode) {

testcases/kernel/mem/lib/mem.c void oom(int testcase, int lite, int retcode, int · line 163

Quoted 10 lines
testcases/kernel/mem/lib/mem.c +6 -2
+			tst_resm(TPASS, "victim retcode: (%d) %s",
 				retcode, strerror(retcode));
-	} else {
-		tst_resm(TFAIL, "victim unexpectedly ended with retcode: %d, "
+		} else {
+			tst_resm(TFAIL, "victim unexpectedly ended with retcode: %d, "
 				"expected: %d", WEXITSTATUS(status), retcode);
+		}
+	} else {
+		tst_resm(TFAIL, "victim unexpectedly ended");

Is this only theoretical or did you actually run into this? If so, what are the circumstances for this to happen?

Regards,
Jan

Quoted 10 lines
testcases/kernel/mem/lib/mem.c +0 -1
 	}
 }
 
--

1.9.3

--
Mailing list info: http://lists.linux.it/listinfo/ltp

#2 lore raw

PATCH 1/1 mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

Quoted 2 lines · Jan Stancek

Is this only theoretical or did you actually run into this? If so, what are the circumstances for this to happen?

It is only theoretical. I composed this only based on code reading.

Thanks.

#3 lore raw

PATCH 1/1 mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

----- Original Message -----

Quoted 6 lines

From: "Han Pingtian" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Thursday, 25 February, 2016 2:18:19 AM
Subject: Re: [LTP] [PATCH] mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

Quoted 7 lines
Quoted 2 lines · Jan Stancek

Is this only theoretical or did you actually run into this? If so, what are the circumstances for this to happen?

It is only theoretical. I composed this only based on code reading.

Thanks.

I fixed one line going over 80 characters and pushed it.

Regards,
Jan

#4 lore raw

PATCH 1/1 mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

Quoted 10 lines · Jan Stancek

----- Original Message -----

Quoted 7 lines

From: "Han Pingtian" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Thursday, 25 February, 2016 2:18:19 AM
Subject: Re: [LTP] [PATCH] mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true

On Wed, Feb 24, 2016 at 06:03:26AM -0500, Jan Stancek wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Is this only theoretical or did you actually run into this? If so, what are the circumstances for this to happen?

It is only theoretical. I composed this only based on code reading.

Thanks.

I fixed one line going over 80 characters and pushed it.

Thanks!