aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-20 15:17:53 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2020-05-21 22:58:14 +1000
commit64750bf01b0830021682fb6db0ec4b5619ece2d6 (patch)
treedbe882ce3f0dcbd1636fec1eb4d51f572c653e95
parent96237d2e25f1c69bdfc4683e8eecc25478a2042a (diff)
exec: only build read_code when needed
Only build read_code when binary formats that use it are built into the kernel. Link: http://lkml.kernel.org/r/20200515143646.3857579-26-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-rw-r--r--fs/exec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 751ba7fd87e0..61f267093850 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1056,6 +1056,8 @@ out:
}
EXPORT_SYMBOL_GPL(kernel_read_file_from_fd);
+#if defined(CONFIG_HAVE_AOUT) || defined(CONFIG_BINFMT_FLAT) || \
+ defined(CONFIG_BINFMT_ELF_FDPIC)
ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len)
{
ssize_t res = vfs_read(file, (void __user *)addr, len, &pos);
@@ -1064,6 +1066,7 @@ ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len)
return res;
}
EXPORT_SYMBOL(read_code);
+#endif
/*
* Maps the mm_struct mm into the current task struct.