Commit 9c7516d6 authored by David Yang's avatar David Yang Committed by Linus Torvalds

tools/testing/selftests/vm/split_huge_page_test.c: fix application of sizeof to pointer

The coccinelle check report:

  ./tools/testing/selftests/vm/split_huge_page_test.c:344:36-42:
  ERROR: application of sizeof to pointer

Use "strlen" to fix it.

Link: https://lkml.kernel.org/r/20211012030116.184027-1-davidcomponentone@gmail.comSigned-off-by: default avatarDavid Yang <davidcomponentone@gmail.com>
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2e014660
...@@ -341,7 +341,7 @@ void split_file_backed_thp(void) ...@@ -341,7 +341,7 @@ void split_file_backed_thp(void)
} }
/* write something to the file, so a file-backed THP can be allocated */ /* write something to the file, so a file-backed THP can be allocated */
num_written = write(fd, tmpfs_loc, sizeof(tmpfs_loc)); num_written = write(fd, tmpfs_loc, strlen(tmpfs_loc) + 1);
close(fd); close(fd);
if (num_written < 1) { if (num_written < 1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment