[PATCH 2/2] rtld: turn "Already zero" assumptions into asserts
H.J. Lu
hjl.tools@gmail.com
Tue Sep 22 12:28:05 GMT 2020
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.
More information about the Libc-alpha
mailing list