[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221009092420.32850-1-renzhijie2@huawei.com>
Date: Sun, 9 Oct 2022 09:24:20 +0000
From: Ren Zhijie <renzhijie2@...wei.com>
To: <viro@...iv.linux.org.uk>
CC: <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Ren Zhijie <renzhijie2@...wei.com>
Subject: [PATCH -next] coredump: fix unused-function warning
If CONFIG_ELF_CORE is not set,
gcc warns about unused function:
fs/coredump.c:839:12: error: ‘dump_emit_page’ defined but not used [-Werror=unused-function]
static int dump_emit_page(struct coredump_params *cprm, struct page *page)
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
dump_emit_page() only be called by dump_user_range(),
so move it under the CONFIG_ELF_CORE.
Fixes: 06bbaa6dc53c ("[coredump] don't use __kernel_write() on kmap_local_page()")
Signed-off-by: Ren Zhijie <renzhijie2@...wei.com>
---
fs/coredump.c | 48 ++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/fs/coredump.c b/fs/coredump.c
index 3e8630c8d627..dc1cb8440bc9 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -836,6 +836,30 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr)
}
}
+int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
+{
+ if (cprm->to_skip) {
+ if (!__dump_skip(cprm, cprm->to_skip))
+ return 0;
+ cprm->to_skip = 0;
+ }
+ return __dump_emit(cprm, addr, nr);
+}
+EXPORT_SYMBOL(dump_emit);
+
+void dump_skip_to(struct coredump_params *cprm, unsigned long pos)
+{
+ cprm->to_skip = pos - cprm->pos;
+}
+EXPORT_SYMBOL(dump_skip_to);
+
+void dump_skip(struct coredump_params *cprm, size_t nr)
+{
+ cprm->to_skip += nr;
+}
+EXPORT_SYMBOL(dump_skip);
+
+#ifdef CONFIG_ELF_CORE
static int dump_emit_page(struct coredump_params *cprm, struct page *page)
{
struct bio_vec bvec = {
@@ -869,30 +893,6 @@ static int dump_emit_page(struct coredump_params *cprm, struct page *page)
return 1;
}
-int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
-{
- if (cprm->to_skip) {
- if (!__dump_skip(cprm, cprm->to_skip))
- return 0;
- cprm->to_skip = 0;
- }
- return __dump_emit(cprm, addr, nr);
-}
-EXPORT_SYMBOL(dump_emit);
-
-void dump_skip_to(struct coredump_params *cprm, unsigned long pos)
-{
- cprm->to_skip = pos - cprm->pos;
-}
-EXPORT_SYMBOL(dump_skip_to);
-
-void dump_skip(struct coredump_params *cprm, size_t nr)
-{
- cprm->to_skip += nr;
-}
-EXPORT_SYMBOL(dump_skip);
-
-#ifdef CONFIG_ELF_CORE
int dump_user_range(struct coredump_params *cprm, unsigned long start,
unsigned long len)
{
--
2.17.1
Powered by blists - more mailing lists