linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter
@ 2023-07-28 16:39 Ayush Jain
  2023-07-28 17:19 ` [PATCH v2 2/2] selftests: mm: add KSM_MERGE_TIME tests Ayush Jain
  2023-08-08 17:31 ` [PATCH v2 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter Stefan Roesch
  0 siblings, 2 replies; 3+ messages in thread
From: Ayush Jain @ 2023-07-28 16:39 UTC (permalink / raw)
  To: akpm, shuah, pasha.tatashin, zhansayabagdaulet, tyhicks, shr,
	raghavendra.kt
  Cc: linux-mm, linux-kselftest, linux-kernel, Narasimhan.V,
	Santosh.Shukla, Ayush Jain, David Hildenbrand

A missing break in kms_tests leads to kselftest hang when the
parameter -s is used.
In current code flow because of missing break in -s, -t parses
args spilled from -s and as -t accepts only valid values as 0,1
so any arg in -s >1 or <0, gets in ksm_test failure

This went undetected since, before the addition of option -t,
the next case -M would immediately break out of the switch
statement but that is no longer the case

Add the missing break statement.

----Before----
./ksm_tests -H -s 100
Invalid merge type

----After----
./ksm_tests -H -s 100
Number of normal pages:    0
Number of huge pages:    50
Total size:    100 MiB
Total time:    0.401732682 s
Average speed:  248.922 MiB/s

Fixes: 07115fcc15b4 ("selftests/mm: add new selftests for KSM")

Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
v1 -> v2
collect Reviewed-by from David
Updated Fixes tag from commit 9e7cb94ca218 to 07115fcc15b4

 tools/testing/selftests/mm/ksm_tests.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/mm/ksm_tests.c b/tools/testing/selftests/mm/ksm_tests.c
index 435acebdc325..380b691d3eb9 100644
--- a/tools/testing/selftests/mm/ksm_tests.c
+++ b/tools/testing/selftests/mm/ksm_tests.c
@@ -831,6 +831,7 @@ int main(int argc, char *argv[])
 				printf("Size must be greater than 0\n");
 				return KSFT_FAIL;
 			}
+			break;
 		case 't':
 			{
 				int tmp = atoi(optarg);
-- 
2.34.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-08 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 16:39 [PATCH v2 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter Ayush Jain
2023-07-28 17:19 ` [PATCH v2 2/2] selftests: mm: add KSM_MERGE_TIME tests Ayush Jain
2023-08-08 17:31 ` [PATCH v2 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter Stefan Roesch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox