Hi Yuanchu, thank you for this patch!
On Wed, 4 May 2022 00:03:57 +0000 Yuanchu Xie <[email protected]> wrote:
> 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 <[email protected]>
Reviewed-by: SeongJae Park <[email protected]>
Thanks,
SJ
[...]
> ---
> tools/testing/selftests/damon/Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile
> index 0470c5f3e690..a300b4c5b373 100644
> --- a/tools/testing/selftests/damon/Makefile
> +++ b/tools/testing/selftests/damon/Makefile
> @@ -1,6 +1,9 @@
> # SPDX-License-Identifier: GPL-2.0
> # Makefile for damon selftests
>
> +CFLAGS += -Wno-stringop-overread
> +CFLAGS += -Wno-stringop-overflow
> +
> TEST_GEN_FILES += huge_count_read_write
>
> TEST_FILES = _chk_dependency.sh _debugfs_common.sh
> --
> 2.36.0.464.gb9c8b46e94-goog
>
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 <[email protected]>
---
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++
1 file changed, 2 insertions(+)
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 <[email protected]>
*/
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-overread"
#include <fcntl.h>
#include <stdlib.h>
--
2.36.0.464.gb9c8b46e94-goog
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