summaryrefslogtreecommitdiff
path: root/scripts/gcc-plugins/structleak_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gcc-plugins/structleak_plugin.c')
-rw-r--r--scripts/gcc-plugins/structleak_plugin.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/scripts/gcc-plugins/structleak_plugin.c b/scripts/gcc-plugins/structleak_plugin.c
index e89be8f5c859..d8c744233832 100644
--- a/scripts/gcc-plugins/structleak_plugin.c
+++ b/scripts/gcc-plugins/structleak_plugin.c
@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2013-2017 by PaX Team <pageexec@freemail.hu>
- * Licensed under the GPL v2
*
* Note: the choice of the license means that the compilation process is
* NOT 'eligible' as defined by gcc's library exception to the GPL v3,
@@ -11,7 +11,7 @@
* otherwise leak kernel stack to userland if they aren't properly initialized
* by later code
*
- * Homepage: http://pax.grsecurity.net/
+ * Homepage: https://pax.grsecurity.net/
*
* Options:
* -fplugin-arg-structleak_plugin-disable
@@ -37,7 +37,7 @@
__visible int plugin_is_GPL_compatible;
static struct plugin_info structleak_plugin_info = {
- .version = "20190125vanilla",
+ .version = PLUGIN_VERSION,
.help = "disable\tdo not activate plugin\n"
"byref\tinit structs passed by reference\n"
"byref-all\tinit anything passed by reference\n"
@@ -68,9 +68,7 @@ static void register_attributes(void *event_data, void *data)
{
user_attr.name = "user";
user_attr.handler = handle_user_attribute;
-#if BUILDING_GCC_VERSION >= 4007
user_attr.affects_type_identity = true;
-#endif
register_attribute(&user_attr);
}
@@ -105,10 +103,8 @@ static void finish_type(void *event_data, void *data)
if (type == NULL_TREE || type == error_mark_node)
return;
-#if BUILDING_GCC_VERSION >= 5000
if (TREE_CODE(type) == ENUMERAL_TYPE)
return;
-#endif
if (TYPE_USERSPACE(type))
return;
@@ -137,11 +133,9 @@ static void initialize(tree var)
if (!gimple_assign_single_p(stmt))
continue;
rhs1 = gimple_assign_rhs1(stmt);
-#if BUILDING_GCC_VERSION >= 4007
/* ... of a non-clobbering expression... */
if (TREE_CLOBBER_P(rhs1))
continue;
-#endif
/* ... to our variable... */
if (gimple_get_lhs(stmt) != var)
continue;
@@ -174,7 +168,6 @@ static void initialize(tree var)
static unsigned int structleak_execute(void)
{
basic_block bb;
- unsigned int ret = 0;
tree var;
unsigned int i;
@@ -204,7 +197,7 @@ static unsigned int structleak_execute(void)
initialize(var);
}
- return ret;
+ return 0;
}
#define PASS_NAME structleak