From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by sourceware.org (Postfix) with ESMTPS id 851663850436 for ; Wed, 22 Jul 2020 09:36:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 851663850436 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06M9aid7072303 for ; Wed, 22 Jul 2020 09:36:53 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 32brgrj54s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 22 Jul 2020 09:36:53 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06M9M20l034136 for ; Wed, 22 Jul 2020 09:36:53 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 32ejc01vg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 22 Jul 2020 09:36:52 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06M9aqtX020815 for ; Wed, 22 Jul 2020 09:36:52 GMT Received: from loom (/81.187.191.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 22 Jul 2020 09:36:52 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: Re: [PATCH 52/59] fixup! libctf, link: tie in the deduplicating linker References: <20200630233146.338613-1-nick.alcock@oracle.com> <20200630233146.338613-53-nick.alcock@oracle.com> Emacs: because one operating system isn't enough. Date: Wed, 22 Jul 2020 10:36:50 +0100 In-Reply-To: <20200630233146.338613-53-nick.alcock@oracle.com> (Nick Alcock via Binutils's message of "Wed, 1 Jul 2020 00:31:39 +0100") Message-ID: <87a6zrx559.fsf_-_@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9689 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220071 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9689 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 impostorscore=0 suspectscore=1 adultscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 phishscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220072 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY 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: Wed, 22 Jul 2020 09:36:55 -0000 We can't use -1 here without causing trouble on platforms with 32-bit ssize_t. We also have to cast the input to labs to long int to allow for platforms on which ssize_t is long long (it's easier to do that than it is to use llabs, which is less common: counts of inputs that exceed 32 bits are prohibited anyway so we don't care about any precision loss that high up.) So much work for such an unlikely error case :) --- libctf/ctf-link.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index fd7298749cd..f269fe7ac0e 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -1176,14 +1176,15 @@ ctf_link_deduplicating_per_cu (ctf_file_t *fp) uint32_t noutputs; uint32_t *parents; - if ((ninputs = ctf_link_deduplicating_count_inputs (fp, in, &only_input)) < 0) + if ((ninputs = ctf_link_deduplicating_count_inputs (fp, in, + &only_input)) == -1) goto err_open_inputs; /* CU mapping with no inputs? Skip. */ if (ninputs == 0) continue; - if (ninputs > -1) + if (labs ((long int) ninputs) > 0xfffffffe) { ctf_err_warn (fp, 0, "Too many inputs in deduplicating link: %li", (long int) ninputs); -- 2.27.0.247.g3dff7de930