From: Kevin Brodsky <kevin.brodsky@arm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Kevin Brodsky <kevin.brodsky@arm.com>,
Ryan Roberts <ryan.roberts@arm.com>,
aruna.ramakrishna@oracle.com, catalin.marinas@arm.com,
dave.hansen@linux.intel.com, joey.gouly@arm.com,
keith.lucas@oracle.com, shuah@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
x86@kernel.org
Subject: [PATCH] selftests/mm: silence unused-result warnings
Date: Tue, 7 Jan 2025 17:01:10 +0000 [thread overview]
Message-ID: <20250107170110.2819685-1-kevin.brodsky@arm.com> (raw)
In-Reply-To: <20241209095019.1732120-6-kevin.brodsky@arm.com>
Switching to -O2 when building the mm tests has the unexpected side
effect of triggering many unused-result warnings on certain distros
like Ubuntu, where GCC is configured so that -O2 implies
-D_FORTIFY_SOURCE.
Explicitly disable FORTIFY_SOURCE to avoid those warnings. This has
no effect on upstream toolchains where FORTIFY_SOURCE is not
implicitly enabled.
Suggested-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---
Hi Andrew,
Could you please take this fixup patch for "selftests/mm: Build with
-O2" in mm-unstable? Ryan found that building the mm kselftests on
Ubuntu yields a bunch of warnings, this patch suppresses them.
Cheers,
- Kevin
Cc: aruna.ramakrishna@oracle.com
Cc: catalin.marinas@arm.com
Cc: dave.hansen@linux.intel.com
Cc: joey.gouly@arm.com
Cc: keith.lucas@oracle.com
Cc: shuah@kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: x86@kernel.org
---
tools/testing/selftests/mm/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index fce194a92cad..d633d6b6a6e1 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -36,6 +36,13 @@ MAKEFLAGS += --no-builtin-rules
CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
LDLIBS = -lrt -lpthread -lm
+# Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
+# automatically enabled at -O1 or above. This triggers various unused-result
+# warnings where functions such as read() or write() are called and their
+# return value is not checked. Disable _FORTIFY_SOURCE to silence those
+# warnings.
+CFLAGS += -U_FORTIFY_SOURCE
+
KDIR ?= /lib/modules/$(shell uname -r)/build
ifneq (,$(wildcard $(KDIR)/Module.symvers))
ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))
--
2.47.0
next prev parent reply other threads:[~2025-01-07 17:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 9:50 [PATCH 00/14] pkeys kselftests improvements Kevin Brodsky
2024-12-09 9:50 ` [PATCH 01/14] selftests/mm: Fix condition in uffd_move_test_common() Kevin Brodsky
2024-12-09 9:50 ` [PATCH 02/14] selftests/mm: Fix -Wmaybe-uninitialized warnings Kevin Brodsky
2024-12-09 9:50 ` [PATCH 03/14] selftests/mm: Fix strncpy() length Kevin Brodsky
2024-12-09 9:50 ` [PATCH 04/14] selftests/mm: Fix -Warray-bounds warnings in pkey_sighandler_tests Kevin Brodsky
2024-12-18 15:36 ` [PATCH] selftests/mm: Fix -Wnull-dereference on Clang Kevin Brodsky
2024-12-09 9:50 ` [PATCH 05/14] selftests/mm: Build with -O2 Kevin Brodsky
2025-01-07 17:01 ` Kevin Brodsky [this message]
2024-12-09 9:50 ` [PATCH 06/14] selftests/mm: Remove unused pkey helpers Kevin Brodsky
2024-12-09 9:50 ` [PATCH 07/14] selftests/mm: Define types using typedef in pkey-helpers.h Kevin Brodsky
2024-12-09 9:50 ` [PATCH 08/14] selftests/mm: Ensure pkey-*.h define inline functions only Kevin Brodsky
2024-12-09 9:50 ` [PATCH 09/14] selftests/mm: Remove empty pkey helper definition Kevin Brodsky
2024-12-09 9:50 ` [PATCH 10/14] selftests/mm: Ensure non-global pkey symbols are marked static Kevin Brodsky
2024-12-09 9:50 ` [PATCH 11/14] selftests/mm: Use sys_pkey helpers consistently Kevin Brodsky
2024-12-15 22:09 ` Alexander Gordeev
2024-12-16 9:28 ` [PATCH] selftests/mm: fix dependency on pkey_util.c Kevin Brodsky
2024-12-09 9:50 ` [PATCH 12/14] selftests/mm: Rename pkey register macro Kevin Brodsky
2024-12-09 9:50 ` [PATCH 13/14] selftests/mm: Skip pkey_sighandler_tests if support is missing Kevin Brodsky
2024-12-09 9:50 ` [PATCH 14/14] selftests/mm: Remove X permission from sigaltstack mapping Kevin Brodsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250107170110.2819685-1-kevin.brodsky@arm.com \
--to=kevin.brodsky@arm.com \
--cc=akpm@linux-foundation.org \
--cc=aruna.ramakrishna@oracle.com \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=joey.gouly@arm.com \
--cc=keith.lucas@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox