From patchwork Wed Jul 31 18:01:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonwon Kang X-Patchwork-Id: 11069029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE70F746 for ; Wed, 31 Jul 2019 18:02:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8D16271CB for ; Wed, 31 Jul 2019 18:02:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC9E0274A3; Wed, 31 Jul 2019 18:02:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 04DA7271CB for ; Wed, 31 Jul 2019 18:02:13 +0000 (UTC) Received: (qmail 9694 invoked by uid 550); 31 Jul 2019 18:02:12 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9651 invoked from network); 31 Jul 2019 18:02:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oaDZjxG3hf3XfIhJ0wNeSSq3sNs3Jdwm87Y90Lg53os=; b=SKwm/tKUjPhh7Ots6DumW+369InP9Y2lmV1wmGybkCv0R6omOv37Uq47RXnIirIKia opq8eRugeFtK7GjZou9O9XXyWH6xG8wQKJrm8VSBkDjeAeZd7tVNOdiN2FRBMB5v8ZAl wu+t+Jw9he5Id6CUsfAZo1ka5O7jl3A6JQT+Cxb9MRWbSOLDiBIzDKtZEeWLOiMrxS7H J/HZ7dbfGeZZCbYKu/XA+KgO8X9yyU23bzKjgizRsFw9qoY5zELut/2+3baGCSgZjZ+i XkoMqMGJ23aGab01Aws21ufDI6ctzimNBp0sOHAoQfhn71lZvFH6QPjrREDYhCjgE16y jsQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oaDZjxG3hf3XfIhJ0wNeSSq3sNs3Jdwm87Y90Lg53os=; b=sa5rg1v4GmbUI9zm+ywSIK+20F1I4E4mtDtUTFQ9+zO8kSiKN/o61F5htrRgHX+buF VoOBw49TTk56ZvYbXgnA8kYHwugr76M4p1sCxbWOqAtzMylT0CV0HfmwiTGfaECuSoJ3 /nJTDUJtk/msa2SiJFbUvRc1V50nEw7z+mYuLdIn+WhTLiAWZ2F2ZwJWh9o5/IiR9HF7 d4RAn5MvGVkFa+7I/EnBUO2XIwQkC9TdFxZpFCvpO35Kv/FG/LccFTTbANVB7sd/3k2+ 9FNAvkt7iKZ74zeSaAZJElT4vlfsKK8CAvb/zzRLMvKllKNIBt+DyCpMAE8pycZJnRsb BwkA== X-Gm-Message-State: APjAAAWIsI98oMVa/pdpRBVFQUSzRMcNPqn1j541hZgeY6CZkxj4f5P6 O7nmaqGa+y25GQ8rFQKycsM= X-Google-Smtp-Source: APXvYqzzGoe74Mz7GNUOaB6q/Km/WB4j0N1VMsCqKCyLVSFJnrP7Bn9v2TTLduZOyynn180hJB4tgA== X-Received: by 2002:a17:902:b497:: with SMTP id y23mr122219821plr.68.1564596119868; Wed, 31 Jul 2019 11:01:59 -0700 (PDT) Date: Thu, 1 Aug 2019 03:01:49 +0900 From: Joonwon Kang To: keescook@chromium.org Cc: re.emese@gmail.com, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, jinb.park7@gmail.com Subject: [PATCH 2/2] randstruct: remove dead code in is_pure_ops_struct() Message-ID: <281a65cc361512e3dc6c5deffa324f800eb907be.1564595346.git.kjw1627@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;