kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joonwon Kang <kjw1627@gmail.com>
To: Kees Cook <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: Re: [PATCH 2/2] randstruct: remove dead code in is_pure_ops_struct()
Date: Thu, 01 Aug 2019 13:41:49 +0000	[thread overview]
Message-ID: <20190801134149.GA2149@host> (raw)
In-Reply-To: <201907311259.D485EED2B7@keescook>

On Wed, Jul 31, 2019 at 12:59:30PM -0700, Kees Cook wrote:
> On Thu, Aug 01, 2019 at 03:01:49AM +0900, Joonwon Kang wrote:
> > 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.
> 
> Is that the only case where this loop could happen? Seems also safe to
> just leave it as-is...
> 
> -Kees

I think it is pretty obvious that it is the only case. I compiled kernel
with allyesconfig and the condition never hit even once. However, it will
also be no problem to just leave it as-is as you mentioned.

> 
> > 
> > Signed-off-by: Joonwon Kang <kjw1627@gmail.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
> > 
> 
> -- 
> Kees Cook

      reply	other threads:[~2019-08-01 13:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 18:00 [PATCH 0/2] fix is_pure_ops_struct() Joonwon Kang
2019-07-31 18:01 ` [PATCH 1/2] randstruct: fix a bug in is_pure_ops_struct() Joonwon Kang
2019-07-31 19:58   ` Kees Cook
2019-07-31 18:01 ` [PATCH 2/2] randstruct: remove dead code " Joonwon Kang
2019-07-31 19:59   ` Kees Cook
2019-08-01 13:41     ` Joonwon Kang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190801134149.GA2149@host \
    --to=kjw1627@gmail.com \
    --cc=jinb.park7@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=re.emese@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).