From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 96CE33858C5E for ; Wed, 8 Feb 2023 19:52:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 96CE33858C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318JncgG023283; Wed, 8 Feb 2023 19:52:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=IeMwnRzP5TbyJJ/dxG6byLSiVj2UW6M4htDUm8HZnxM=; b=epCqsWRzbQZ+t5xCEWqrVCoNswR+/1/zSjqvV3V0YWG8D8M2hGCT1UNFtlwfLX3lwdPy l9rDwzxo3UNrpz8s3xHsD5ax6yYDmcesb3MOwjseKqmDI149Pzgyq7IcObA1FuL7hy5m oOk60N7wh8GbLSAXxaxqwJUlHbtZYMx8qVMuFKjFbytenQPL1r7b1wU1FpgaxUbJ/CUS YfrxaoyOhyUfQbc4+Zq+o4tD9GfCnYowI6rD3LQtUlEaB1R9y2vasD93HlJYyz4mjtbw d354nFs89w2TUZduWj/cvgGwn4LCJnbI3l+uA81gKz/IU4pQ8t72P2Y+WRtuRauo9IYo GA== Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmj8302dh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:38 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3182kWG8017256; Wed, 8 Feb 2023 19:52:36 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3nhf06usf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:35 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqWx151511744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:32 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 386CE20043; Wed, 8 Feb 2023 19:52:32 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E52A020040; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) From: Ilya Leoshkevich To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 3/7] readelf: Fix set but not used parameter Date: Wed, 8 Feb 2023 20:52:22 +0100 Message-Id: <20230208195226.144143-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: O3Ov_MoXqzszz_jsnUGiWZPTr8XSob6m X-Proofpoint-GUID: O3Ov_MoXqzszz_jsnUGiWZPTr8XSob6m Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 mlxlogscore=847 adultscore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: clang complains: readelf.c:12205:72: error: parameter 'desc' set but not used [-Werror,-Wunused-but-set-parameter] handle_bit_registers (const Ebl_Register_Location *regloc, const void *desc, ^ Mark Wielaard says: It is never really used since as far as I can see we don't have any backend with a core register sets where a register doesn't have a number of bits which isn't a multiple of 8 (only ia64 has some 1 bit registers, but those don't seem part of the core register set). If we do accidentally try to handle such a register having an abort is also not very nice. Lets just warn and return/continue. https://sourceware.org/bugzilla/show_bug.cgi?id=30084 Co-developed-by: Mark Wielaard Signed-off-by: Ilya Leoshkevich --- src/readelf.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 0bbd708e..5b3319c2 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -12199,24 +12199,17 @@ handle_core_items (Elf *core, const void *desc, size_t descsz, return colno; } -static unsigned int -handle_bit_registers (const Ebl_Register_Location *regloc, const void *desc, - unsigned int colno) -{ - desc += regloc->offset; - - abort (); /* XXX */ - return colno; -} - - static unsigned int handle_core_register (Ebl *ebl, Elf *core, int maxregname, const Ebl_Register_Location *regloc, const void *desc, unsigned int colno) { if (regloc->bits % 8 != 0) - return handle_bit_registers (regloc, desc, colno); + { + error (0, 0, "Warning: Cannot handle register with %" PRIu8 "bits\n", + regloc->bits); + return colno; + } desc += regloc->offset; -- 2.39.1