Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20539453rwd; Thu, 29 Jun 2023 03:53:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61l6k6VM9cVA6j5YftlUN/ByZktEWk4BknroSycGRkhANwQ8JfwRY3hNxAaCIiHv9cgDOz X-Received: by 2002:a05:6358:c10a:b0:134:e977:d8ec with SMTP id fh10-20020a056358c10a00b00134e977d8ecmr1771494rwb.7.1688035986252; Thu, 29 Jun 2023 03:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688035986; cv=none; d=google.com; s=arc-20160816; b=s6y/3x5/hRfxtQkderhENZe2kEbyAgmbTOR+ke8iCRLfH1evksodqpbVIAiTL0aA9V /z6PUwTPLee2wMcodnjLd/3DOGzToLbYlXoo+iEE9YB6Q6ydnOvfv1Lo+hjXVsFi5KRx 0AOz5Kzd1F1V1hr4lzHe5q72Y/NgRF1vvwxB61IFQ8H/1cIckO/r8GNct8KVDN7T6Yjj fUzA5qFDgISiv511El1bgOVdpDuXSIeZ1+U882SR9tNaVkTUdGllK2K2Yyo9BjXvf/sO kOMD5rEP07+V1PZGyScxU3c5hQ1m/Jcv12YLTmIa0HLWs4rKN7FYLmwxninSnZ1Qm2gI j0MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:to:subject:date:from:dkim-signature :dkim-signature; bh=LECm0m+o+ZGRGygtSk68YR+QZWIj672OOurGXfyr1cw=; fh=6fzjPYpZ77N8VlnWv6JKU25XVjCreGrjztShxVCqZeY=; b=GhmOlFkx+nG5cSzUWunjfo8inWrG6KqDTmp/F9l4c38oCJ6eaaKG+V6277bWpqTFXy pO+FpHvFbcHeHrBz0pGoKKMcpgvZaQnqHZj+IS1rkrJAqIsnUQcAm5FXzrt1LH+epjDr GgssyDwq+6gbCPGXOsmy0kSvZJAB0NUMhN5iry8x73iwMBmtbh4GRXvBIIZpAIF4KDu8 +EwKeO4ivyxHlqOJOeVptkn99CgLNISSatqw7RlPeXZJWzz9vTjTDLccXb6Ou4Pp4LYh aTqK+kp9kdA9CQv0p8q1XS4/9R+gk2LzW4uZ6wg6FnbBIeZ7sxL0CCWdUgPYTtaC315R Kx+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=lCOfNeyf; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=KVx3ER4n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h64-20020a638343000000b0054fdb022ce1si10479619pge.219.2023.06.29.03.52.51; Thu, 29 Jun 2023 03:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=lCOfNeyf; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=KVx3ER4n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231363AbjF2KVB (ORCPT + 99 others); Thu, 29 Jun 2023 06:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjF2KU7 (ORCPT ); Thu, 29 Jun 2023 06:20:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47FB8A2 for ; Thu, 29 Jun 2023 03:20:58 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D8D081F8AA; Thu, 29 Jun 2023 10:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688034056; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc; bh=LECm0m+o+ZGRGygtSk68YR+QZWIj672OOurGXfyr1cw=; b=lCOfNeyf5kzJv7YTXv9OeKNWsYWCcZv6BbYgs8PIYnowiGyZY4qoVr0OMwpL3XEnV2M2Do Vvm+TzgEAtfOUkwy67XkUKn5TB7kUZ4hnRAdQPh8wSyoTAVoP/kaU20oZcT2VsfC0ebnZ7 o+2cLO2G/48Me5nG7gO9LzJWKIiqMYM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688034056; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc; bh=LECm0m+o+ZGRGygtSk68YR+QZWIj672OOurGXfyr1cw=; b=KVx3ER4ncZWVE1Igx2AfojNi3NgSNVipgG3+blOuTMWIUoIwRxL0mNRWXrPVmd1Nsce1sF c6mORTabMiAZHxAA== Received: from lion.mk-sys.cz (unknown [10.163.44.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C63DB2C141; Thu, 29 Jun 2023 10:20:56 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id 42E8360467; Thu, 29 Jun 2023 12:20:51 +0200 (CEST) From: Michal Kubecek Date: Thu, 29 Jun 2023 12:05:05 +0200 Subject: [PATCH] objtool: initialize all of struct elf To: Josh Poimboeuf , Peter Zijlstra , linux-kernel@vger.kernel.org Message-Id: <20230629102051.42E8360467@lion.mk-sys.cz> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function elf_open_read() only zero initializes the initial part of allocated struct elf; num_relocs member was recently added outside the zeroed part so that it was left uninitialized, resulting in build failures on some systems. The partial initialization is a relic of times when struct elf had large hash tables embedded. This is no longer the case so remove the trap and initialize the whole structure instead. Fixes: eb0481bbc4ce ("objtool: Fix reloc_hash size") Signed-off-by: Michal Kubecek --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index d420b5d2e2b6..081befa4674b 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1005,7 +1005,7 @@ struct elf *elf_open_read(const char *name, int flags) perror("malloc"); return NULL; } - memset(elf, 0, offsetof(struct elf, sections)); + memset(elf, 0, sizeof(*elf)); INIT_LIST_HEAD(&elf->sections); -- 2.41.0