From patchwork Mon Nov 20 14:44:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 167185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2249595vqn; Mon, 20 Nov 2023 06:44:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUQraGFTb44lvZtgJlSc9JoSSjAUj4oX776Kc886CRMJpxXaOB+dTjkQVu08PYrVmX5VT1 X-Received: by 2002:a54:461a:0:b0:3ab:7f46:ecc5 with SMTP id p26-20020a54461a000000b003ab7f46ecc5mr7428075oip.35.1700491468262; Mon, 20 Nov 2023 06:44:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700491468; cv=none; d=google.com; s=arc-20160816; b=p00MjStx4m9Bfl52qRDU6tltJgrzlvnoF/LWzyblIlyXrOqBb9kCgm6hpDsT4AgMKR oot5G0xwjNrhMSfbaAzXs49mNYEhKo5TxwVIDb/M3S8lbMP7RgR0fz+7T+3TKjPKUtQq qHvyjiqeJnsVRt7HtmH8yjd36h2mlzpbSINNtIzIAMk2V7jUYM8ZiQtfBEXU9KXDoELn D6cYfCFhAwSvsOlkEEzTif8cSWRN+vCGzz6XDH8FRrSjqz2wCZa3sXo5awvkSAz3KfFe dAzzAOTPK1r9tSKRUWBv7n43Nw3VC+ts3nskdy9H/Ria1QOpzZ1PmuWgsKaMPawj4suX 8uJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=QnRXy1yVWCfRsNPkXtlfyjrD/wRceMj0d6uDTf+ma9g=; fh=FZidfF7yv0pdp9LgqfDslDBJcEoR5sLRFHtNjDbR9B0=; b=RBMUcAL4ELqYxHMw+TU3agQ71jQuDxm0scdWIz0Q6tTmVMLQPETUewPqxahk1hiGdn B5FILmass5O5Ut/bleTt9agmsqs/7xC8tbktMkX3j3h35FcvEQEYUtaGE46LXxQF0H11 yeAkH94zpu7XTyKKsvepvPiK8p6NoG13iOPMTEBEOOkOf401F9KhnaI9dNYVAZG4Z7pc iGt2SN7Z6OpFB0puWWiOcBUIRsqIXDEwsQn2RlooQzuwdnnQyilkmLiFsNLZnOZeFZN1 PN42An7dwdHAcFjIObodUWsjBh25mouxNqhDWUN1hk1a6XCM6eQv7u8LxeHH71tZx6g3 qG0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0BlJ6M8f; dkim=neutral (no key) header.i=@linutronix.de header.b="/mKtkhSn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n189-20020a6327c6000000b00589884fef91si8527892pgn.740.2023.11.20.06.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 06:44:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0BlJ6M8f; dkim=neutral (no key) header.i=@linutronix.de header.b="/mKtkhSn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 33820806141E; Mon, 20 Nov 2023 06:44:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbjKTOoZ (ORCPT + 27 others); Mon, 20 Nov 2023 09:44:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232259AbjKTOoY (ORCPT ); Mon, 20 Nov 2023 09:44:24 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF0FCA4; Mon, 20 Nov 2023 06:44:20 -0800 (PST) Date: Mon, 20 Nov 2023 14:44:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700491459; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QnRXy1yVWCfRsNPkXtlfyjrD/wRceMj0d6uDTf+ma9g=; b=0BlJ6M8fsA1cn0Saynwt3eMvOQxRRBkHxrCXEd6vWQ4O3Uk9fHbtr64pdPk99rdpHCZqAQ aVO+1QGeIw6fvXD1rlAg6EtFbqZdPkpAf1Zh8wJL8w4atSc7BDVQz5tCDfs1CmEHdexqAx A08cv8RQRfL1ft+ioZZAvhMuVvHoK6AWRH+SO6WUVJCuBkbn5svhB5aeRZuOOZTTuClyQb OX6m56y8hiIo2Oeb+5WLWpbyVWWZzB15rJACYN4NCyKlTel1gVibTMJwj2Fjamx4G/usta iFhvS1/2E9PxqHqlPbtlHO3XjFx4kPPTyj1+Z29aCpSZFs5AfdNqdqPTVO5BQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700491459; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QnRXy1yVWCfRsNPkXtlfyjrD/wRceMj0d6uDTf+ma9g=; b=/mKtkhSn9YyfjlpsCgPUYDdjiJZn+YNDOZdtk/QosgHQ1NN6ZEnpdi1fl8Mgu3nYsCM6KT BpIOeoccBYBEIuDw== From: "tip-bot2 for Sam James" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Fix calloc call for new -Walloc-size Cc: Sam James , "Peter Zijlstra (Intel)" , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231107205504.1470006-1-sam@gentoo.org> References: <20231107205504.1470006-1-sam@gentoo.org> MIME-Version: 1.0 Message-ID: <170049145878.398.18419078180350195785.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 06:44:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781940125269161749 X-GMAIL-MSGID: 1783094541463474507 The following commit has been merged into the objtool/core branch of tip: Commit-ID: e2e13630f93d942d02f3b3f98660228a3545c60e Gitweb: https://git.kernel.org/tip/e2e13630f93d942d02f3b3f98660228a3545c60e Author: Sam James AuthorDate: Tue, 07 Nov 2023 20:55:00 Committer: Peter Zijlstra CommitterDate: Fri, 17 Nov 2023 10:54:50 +01:00 objtool: Fix calloc call for new -Walloc-size GCC 14 introduces a new -Walloc-size included in -Wextra which errors out like: ``` check.c: In function ‘cfi_alloc’: check.c:294:33: error: allocation of insufficient size ‘1’ for type ‘struct cfi_state’ with size ‘320’ [-Werror=alloc-size] 294 | struct cfi_state *cfi = calloc(sizeof(struct cfi_state), 1); | ^~~~~~ ``` The calloc prototype is: ``` void *calloc(size_t nmemb, size_t size); ``` So, just swap the number of members and size arguments to match the prototype, as we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not doing anything wrong. Signed-off-by: Sam James Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20231107205504.1470006-1-sam@gentoo.org --- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index e94756e..548ec3c 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -291,7 +291,7 @@ static void init_insn_state(struct objtool_file *file, struct insn_state *state, static struct cfi_state *cfi_alloc(void) { - struct cfi_state *cfi = calloc(sizeof(struct cfi_state), 1); + struct cfi_state *cfi = calloc(1, sizeof(struct cfi_state)); if (!cfi) { WARN("calloc failed"); exit(1);