unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
To: Rolf Eike Beer <eb@emlix.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/2] rtld: turn "Already zero" assumptions into asserts
Date: Tue, 22 Sep 2020 05:28:05 -0700	[thread overview]
Message-ID: <CAMe9rOrnzxZTUgehYCDeakU59bjpus7WvuzFktoDJ5m1-mTiDA@mail.gmail.com> (raw)
In-Reply-To: <20200922121300.3503-2-eb@emlix.com>

On Tue, Sep 22, 2020 at 5:13 AM Rolf Eike Beer <eb@emlix.com> wrote:
>
> ---
>  elf/rtld.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/elf/rtld.c b/elf/rtld.c
> index 99d130cd1c..441d837095 100644
> --- a/elf/rtld.c
> +++ b/elf/rtld.c
> @@ -1449,7 +1449,7 @@ of this helper program; chances are you did not intend to run this program.\n\
>            the shared object is already loaded.  */
>         _dl_rtld_libname.name = ((const char *) main_map->l_addr
>                                  + ph->p_vaddr);
> -       /* _dl_rtld_libname.next = NULL;        Already zero.  */
> +       assert(_dl_rtld_libname.next == NULL);
Space after assert.  Same applies to other changes.
and there are

rtld.c:static struct libname_list _dl_rtld_libname;
rtld.c:static struct libname_list _dl_rtld_libname2;

There is no need for assert of zero on static variables.

>         GL(dl_rtld_map).l_libname = &_dl_rtld_libname;
>
>         /* Ordinarilly, we would get additional names for the loader from
> @@ -1470,7 +1470,7 @@ of this helper program; chances are you did not intend to run this program.\n\
>             if (p != NULL)
>               {
>                 _dl_rtld_libname2.name = p;
> -               /* _dl_rtld_libname2.next = NULL;  Already zero.  */
> +               assert(_dl_rtld_libname2.next == NULL);
>                 _dl_rtld_libname.next = &_dl_rtld_libname2;
>               }
>           }
> @@ -1555,7 +1555,7 @@ of this helper program; chances are you did not intend to run this program.\n\
>        /* We were invoked directly, so the program might not have a
>          PT_INTERP.  */
>        _dl_rtld_libname.name = GL(dl_rtld_map).l_name;
> -      /* _dl_rtld_libname.next = NULL; Already zero.  */
> +      assert(_dl_rtld_libname.next == NULL);
>        GL(dl_rtld_map).l_libname =  &_dl_rtld_libname;
>      }
>    else
> --
> 2.28.0
>


-- 
H.J.

  reply	other threads:[~2020-09-22 12:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 12:12 [PATCH 1/2] rtld: fix typo in comment Rolf Eike Beer
2020-09-22 12:13 ` [PATCH 2/2] rtld: turn "Already zero" assumptions into asserts Rolf Eike Beer
2020-09-22 12:28   ` H.J. Lu via Libc-alpha [this message]
2020-09-22 12:38     ` Rolf Eike Beer
2020-09-22 12:23 ` [PATCH 1/2] rtld: fix typo in comment H.J. Lu via Libc-alpha
2020-10-12  7:08   ` Rolf Eike Beer
2020-10-13 12:52     ` H.J. Lu via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=CAMe9rOrnzxZTUgehYCDeakU59bjpus7WvuzFktoDJ5m1-mTiDA@mail.gmail.com \
    --to=libc-alpha@sourceware.org \
    --cc=eb@emlix.com \
    --cc=hjl.tools@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 read-only IMAP folder(s) and NNTP newsgroup(s).