From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 59BB53858D28 for ; Thu, 2 Nov 2023 23:24:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 59BB53858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 59BB53858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698967450; cv=none; b=ZOJiwoF61SeCWHgW9oBewmzlr0QNY11/H9FNOXuviPkSqqM3WIjDsx/EyC6hMq5wa4usHoGpzE1tJUGhFeKEb9fMEAVdVv+4TYVyZPlh0pAhCu7J2VbAjMJ1ahDEC96HzUCO3fDe84xX1RvKPbYGAZW6iYewx/k1Za4Pbv/SXzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698967450; c=relaxed/simple; bh=qKIXMVGllXhZXEnmZW8qgvMh5XXwZ66CsC9gDLghtC0=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=MOhsU3lZsrrnL+C6EmQNarYx1i/a1BCNL7/APXeuONYmWQpDcx+EQ3PPcFMoid2r9mMBVRs9t3o+aDRF+TT2RA+k3muAViTi6VXXhdtx0anZLEYU1MAbNsJ33AhaxpZXPdxNgvr0RNBhi/7Xus5AECZs+X+zZfkDsT6Il+ME7dc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by gnu.wildebeest.org (Postfix, from userid 1000) id 5D7C0302FDC3; Fri, 3 Nov 2023 00:23:59 +0100 (CET) Date: Fri, 3 Nov 2023 00:23:59 +0100 From: Mark Wielaard To: Sergei Trofimovich Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH] libelf/elf_newscn.c: fix build failure against gcc-14 (-Walloc-size) Message-ID: <20231102232358.GT8429@gnu.wildebeest.org> References: <20231102195846.1414311-1-slyich@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231102195846.1414311-1-slyich@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-3028.2 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Sergei, On Thu, Nov 02, 2023 at 07:58:46PM +0000, Sergei Trofimovich wrote: > `gcc-14` adde a new -Walloc-size warning that makes sure that size of an > individual element matches size of a pointed type: > > https://gcc.gnu.org/PR71219 > > `elfutils` triggers is on `calloc()` call where member size is sued as > `1`. > > elf_newscn.c: In function `elf_newscn`: > elf_newscn.c:97:12: error: allocation of insufficient size «1» for type «Elf_ScnList» with size «16» [-Werror=alloc-size] > 97 | newp = calloc (sizeof (Elf_ScnList) > | ^ > > The change swaps arguments to pass larger value as a member size. Very nice. Patch applied. Thanks, Mark