Skip to content

Commit 65294de

Browse files
AYUSHJAIN951akpm00
authored andcommitted
selftests: mm: ksm: fix incorrect evaluation of parameter
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 Link: https://lkml.kernel.org/r/[email protected] Fixes: 07115fc ("selftests/mm: add new selftests for KSM") Signed-off-by: Ayush Jain <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Stefan Roesch <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 32c8771 commit 65294de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/testing/selftests/mm/ksm_tests.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ int main(int argc, char *argv[])
831831
printf("Size must be greater than 0\n");
832832
return KSFT_FAIL;
833833
}
834+
break;
834835
case 't':
835836
{
836837
int tmp = atoi(optarg);

0 commit comments

Comments
 (0)