From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 40C4C385482D for ; Mon, 1 Mar 2021 15:17:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 40C4C385482D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-140-8PhQsMgKPberAHW3o9qlOw-1; Mon, 01 Mar 2021 10:17:14 -0500 X-MC-Unique: 8PhQsMgKPberAHW3o9qlOw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6EAF71007310; Mon, 1 Mar 2021 15:17:13 +0000 (UTC) Received: from [10.36.114.57] (ovpn-114-57.ams2.redhat.com [10.36.114.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FA805D6CF; Mon, 1 Mar 2021 15:17:12 +0000 (UTC) Subject: Re: [PATCH REVIEW 10/10] bfd, ld, libctf: skip zero-refcount strings in CTF string reporting To: Nick Alcock , binutils@sourceware.org References: <20210227132954.7766-1-nick.alcock@oracle.com> <20210227132954.7766-11-nick.alcock@oracle.com> From: Nick Clifton Organization: Red Hat Message-ID: <4ae83e37-109d-e2c5-12d6-7a5291a4faca@redhat.com> Date: Mon, 1 Mar 2021 15:17:10 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210227132954.7766-11-nick.alcock@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2021 15:17:19 -0000 Hi Nick, > bfd/ChangeLog > 2021-02-26 Nick Alcock > > * elf-strtab.c (_bfd_elf_strtab_str): Skip strings with zero refcount. > > ld/ChangeLog > 2021-02-26 Nick Alcock > > * ldelfgen.c (ldelf_ctf_strtab_iter_cb): Skip zero-refcount strings. This patch is approved, although I have a few minor formatting nits that you might like to correct: > diff --git a/bfd/ChangeLog b/bfd/ChangeLog > index 2fef817d734..f1b4e8a2a46 100644 > --- a/bfd/ChangeLog > +++ b/bfd/ChangeLog > @@ -1,3 +1,7 @@ > +2021-02-26 Nick Alcock > + > + * elf-strtab.c (_bfd_elf_strtab_str): Skip strings with zero refcount. > + Please can changelog entries not be submitted as context diffs. They almost never apply cleanly... > @@ -302,6 +302,8 @@ _bfd_elf_strtab_str (struct elf_strtab_hash *tab, size_t idx, > return 0; > BFD_ASSERT (idx < tab->size); > BFD_ASSERT (tab->sec_size); > + if (tab->array[idx]->refcount == 0) > + return 0; This should really be "return NULL;". (I know that there is a 'return 0;' a few lines above, but that one is wrong too). > @@ -375,13 +375,19 @@ ldelf_ctf_strtab_iter_cb (uint32_t *offset, void *arg_) > if (arg->next_i == 0) > arg->next_i = 1; > > - if (arg->next_i >= _bfd_elf_strtab_len (arg->strtab)) > + /* Hunt through strings until we fall off the end or find one with > + a nonzero refcount. */ > + do > { > - arg->next_i = 0; > - return NULL; > - } > + if (arg->next_i >= _bfd_elf_strtab_len (arg->strtab)) > + { > + arg->next_i = 0; > + return NULL; > + } > + > + ret = _bfd_elf_strtab_str (arg->strtab, arg->next_i++, &off); > + } while (ret == 0); The while statement should be on its own line. IE: } while (ret == 0); Cheers Nick