Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 1 Aug 2019 03:01:49 +0900
From: Joonwon Kang <kjw1627@...il.com>
To: keescook@...omium.org
Cc: re.emese@...il.com, kernel-hardening@...ts.openwall.com,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
	jinb.park7@...il.com
Subject: [PATCH 2/2] randstruct: remove dead code in is_pure_ops_struct()

Recursive declaration for struct which has member of the same struct
type, for example,

struct foo {
    struct foo f;
    ...
};

is not allowed. So, it is unnecessary to check if a struct has this
kind of member.

Signed-off-by: Joonwon Kang <kjw1627@...il.com>
---
 scripts/gcc-plugins/randomize_layout_plugin.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c
index bd29e4e7a524..e14efe23e645 100644
--- a/scripts/gcc-plugins/randomize_layout_plugin.c
+++ b/scripts/gcc-plugins/randomize_layout_plugin.c
@@ -440,9 +440,6 @@ static int is_pure_ops_struct(const_tree node)
 		const_tree fieldtype = get_field_type(field);
 		enum tree_code code = TREE_CODE(fieldtype);
 
-		if (node == fieldtype)
-			continue;
-
 		if (code == RECORD_TYPE || code == UNION_TYPE) {
 			if (!is_pure_ops_struct(fieldtype))
 				return 0;
-- 
2.17.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.