diff mbox series

[v3] selftests/damon: suppress compiler warnings for huge_count_read_write

Message ID 20220504182908.1322874-1-yuanchu@google.com
State New
Headers show
Series [v3] selftests/damon: suppress compiler warnings for huge_count_read_write | expand

Commit Message

Yuanchu Xie May 4, 2022, 6:29 p.m. UTC
The test case added in commit db7a347b26fe ("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation")
intentionally writes and reads with a large count to cause
allocation failure and check for kernel warnings. We suppress
the compiler warnings for these calls as they work as intended.

Signed-off-by: Yuanchu Xie <yuanchu@google.com>
---
 tools/testing/selftests/damon/huge_count_read_write.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Yuanchu Xie May 4, 2022, 6:32 p.m. UTC | #1
Hi SeongJae,

Instead of adding the exception to the Makefile, these two pragmas can
be added to the offending c file instead. Although it is fairly minor and
either one works but I think this is cleaner.

Thanks,
Yuanchu
diff mbox series

Patch

diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c
index ad7a6b4cf338..91bd80c75cd9 100644
--- a/tools/testing/selftests/damon/huge_count_read_write.c
+++ b/tools/testing/selftests/damon/huge_count_read_write.c
@@ -2,6 +2,8 @@ 
 /*
  * Author: SeongJae Park <sj@kernel.org>
  */
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-overread"
 
 #include <fcntl.h>
 #include <stdlib.h>