linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix application of sizeof to pointer
@ 2021-10-12  3:01 davidcomponentone
  2021-10-12  7:01 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: davidcomponentone @ 2021-10-12  3:01 UTC (permalink / raw)
  To: akpm
  Cc: shuah, linux-mm, linux-kselftest, linux-kernel, David Yang, Zeal Robot

From: David Yang <davidcomponentone@gmail.com>

The coccinelle check report:
"./tools/testing/selftests/vm/split_huge_page_test.c:344:36-42:
ERROR: application of sizeof to pointer"
Using the "strlen" to fix it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 tools/testing/selftests/vm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vm/split_huge_page_test.c b/tools/testing/selftests/vm/split_huge_page_test.c
index 1af16d2c2a0a..52497b7b9f1d 100644
--- a/tools/testing/selftests/vm/split_huge_page_test.c
+++ b/tools/testing/selftests/vm/split_huge_page_test.c
@@ -341,7 +341,7 @@ void split_file_backed_thp(void)
 	}
 
 	/* 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);
 
 	if (num_written < 1) {
-- 
2.30.2



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

end of thread, other threads:[~2021-10-12  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  3:01 [PATCH] Fix application of sizeof to pointer davidcomponentone
2021-10-12  7:01 ` David Hildenbrand

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