aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2021-04-14 22:45:39 +0000
committerKees Cook <[email protected]>2021-09-25 15:20:49 +0000
commitc430f60036af44079170ff71a461b9d7cf5ee431 (patch)
tree35cb14f5318bc70591649d0749791ae4f05c961f /lib/string_helpers.c
parentlib/string: Move helper functions out of string.c (diff)
downloadkernel-c430f60036af44079170ff71a461b9d7cf5ee431.tar.gz
kernel-c430f60036af44079170ff71a461b9d7cf5ee431.zip
fortify: Move remaining fortify helpers into fortify-string.h
When commit a28a6e860c6c ("string.h: move fortified functions definitions in a dedicated header.") moved the fortify-specific code, some helpers were left behind. Move the remaining fortify-specific helpers into fortify-string.h so they're together where they're used. This requires that any FORTIFY helper function prototypes be conditionally built to avoid "no prototype" warnings. Additionally removes unused helpers. Cc: Andrew Morton <[email protected]> Cc: Daniel Axtens <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Dan Williams <[email protected]> Acked-by: Francis Laniel <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
-rw-r--r--lib/string_helpers.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index bde13612c25d..faa9d8e4e2c5 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -883,9 +883,11 @@ char *strreplace(char *s, char old, char new)
}
EXPORT_SYMBOL(strreplace);
+#ifdef CONFIG_FORTIFY_SOURCE
void fortify_panic(const char *name)
{
pr_emerg("detected buffer overflow in %s\n", name);
BUG();
}
EXPORT_SYMBOL(fortify_panic);
+#endif /* CONFIG_FORTIFY_SOURCE */