Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/vm/compaction_test: fix write to restore nr_hugepages

The write at the end of the test to restore nr_hugepages to its previous
value is failing. This is because it is trying to write the number of
bytes in the char array as opposed to the number of bytes in the string.

Link: http://lkml.kernel.org/r/1465331205-3284-1-git-send-email-mike.kravetz@oracle.com
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Sri Jayaramappa <sjayaram@akamai.com>
Cc: Eric B Munson <emunson@akamai.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mike Kravetz and committed by
Linus Torvalds
a7b50abc 9df10fb7

+1 -1
+1 -1
tools/testing/selftests/vm/compaction_test.c
··· 136 136 printf("No of huge pages allocated = %d\n", 137 137 (atoi(nr_hugepages))); 138 138 139 - if (write(fd, initial_nr_hugepages, sizeof(initial_nr_hugepages)) 139 + if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages)) 140 140 != strlen(initial_nr_hugepages)) { 141 141 perror("Failed to write to /proc/sys/vm/nr_hugepages\n"); 142 142 goto close_fd;