From patchwork Thu Sep 28 10:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 146176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3395697vqu; Thu, 28 Sep 2023 08:28:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJSMp32/SrUqOiwDMfQyty6HGbG41U8oEUh3q/m32ksHkdJfMfSnRm/idJ/Ra2C40Nqhld X-Received: by 2002:a05:6358:904c:b0:143:21e8:11f2 with SMTP id f12-20020a056358904c00b0014321e811f2mr1698935rwf.11.1695914897040; Thu, 28 Sep 2023 08:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695914897; cv=none; d=google.com; s=arc-20160816; b=HL/3eGWHl3q82GLC91/s/FT6eKGLwDhss0aMkqgPvipZ+yGqJlkvUuivoWn8SSncpb GGCwdnuz4ZcgjuIQ27xZ15VmPlDuk32M7j21PaVMksnYsbuuDt211JN8kxD9Z/JIKJB3 jAfbnqtybHQ2l8JuYkMEkipb2soGCpZ6c5CyEvDwpaT4ioeVBRwaQeNUUuqhg7nWfTqO ICHITAPc0R8+k4EfFCJta6Ll5JkhwDSqlnzaHC1Ayfr5ZgTkOLakL4ZOK5yYjSz7diVj 2vOEl8lt2gWHWt39Mvsr6dXdzhKYmWZLIQRfglQhQ87qy3sgVRDm2k8PLbBAjpv5cgIy /Apg== 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=tYmau7IMl7WD2vSqAsJO1NOZjklCa/Lh+h32BSGKsfg=; fh=1HgvpuOwcRhn9ZPKCOuwtxYetNyDZeY0K0iFoP4+fs4=; b=bj3S3PYWMbfW2BhEHYCMQB4P+sCMVoEYcZ0x8mAWrvi8Lr6SSSF80+FPrTx9R00feX ZqKEmzY/hbX1yy4FjBh5o7w4TJwfIH9hLI38+lX6Aq3JSm4UguQ9CzwsDZhHdSHy/AVC /A3+VC7Lc5aFnysowhyaqbB/vL1ACSFnTUHKNsCHQpap9UT57itx11FjAsJvioaj1RgP Z0fFnqZJtjFw753HDoWItNcuebp6dXveJ0QU0J3wxbo0qLxyVr3tqPK/Ta4Rq+V/azVL tI3d28wfvgoU/f92BYof3k2+Kt84jRHtbpHXwPusQhNhn0sQq/IWmCUl31BJOnCO0//Q 1sPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="dq9tZ/c6"; dkim=neutral (no key) header.i=@linutronix.de header.b=OjLa2oqg; 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 cf4-20020a056a02084400b00578fdfa353asi18468102pgb.402.2023.09.28.08.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 08:28:16 -0700 (PDT) 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="dq9tZ/c6"; dkim=neutral (no key) header.i=@linutronix.de header.b=OjLa2oqg; 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 8AD9E8212AA2; Thu, 28 Sep 2023 03:32:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjI1Kcr (ORCPT + 21 others); Thu, 28 Sep 2023 06:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbjI1Kcm (ORCPT ); Thu, 28 Sep 2023 06:32:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F3C7122; Thu, 28 Sep 2023 03:32:41 -0700 (PDT) Date: Thu, 28 Sep 2023 10:32:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695897159; 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=tYmau7IMl7WD2vSqAsJO1NOZjklCa/Lh+h32BSGKsfg=; b=dq9tZ/c6tKrFbBdurzccbRSM4NT/LiWfOSNApkP0hxdWF5JtgR45DwlWSGedTwqs/4Myen WyGMQ1doOG9XCSGZ+pyTgE+BMxVj0jwKtb1ZkOyoFcRmKwaXTwMKuz6IRmMzCpZxbW7br8 9BXdzsGkx+VNbogDftJS2RjvcNGWA3FINyftTEJYYBvJ6VSxZSe6Y4BJ/2mXUiXCcGCEzx 0bBz30V44qkdENThcfGvXw889e5HMm65HMI1SSXohhyZP/JRWc9FA3BslqLuxc4mmcNtZE fF1uglxixSvwOz3xWOfrAjNJ+kyJ0B58/RuRytz7PukYzxFANKFtz0U3VvpmVA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695897159; 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=tYmau7IMl7WD2vSqAsJO1NOZjklCa/Lh+h32BSGKsfg=; b=OjLa2oqg288XV6d2qE/rfOCJsuuRZ0uUWotWLBBFxO+3qqDn6HGauMKpbRa5MelEocOIfG p6ZXKRB/UAyiHyDg== From: "tip-bot2 for Kees Cook" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] irqdomain: Annotate struct irq_domain with __counted_by Cc: Kees Cook , Thomas Gleixner , "Gustavo A. R. Silva" , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20230922175127.work.214-kees@kernel.org> References: <20230922175127.work.214-kees@kernel.org> MIME-Version: 1.0 Message-ID: <169589715833.27769.918219900124749489.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 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]); Thu, 28 Sep 2023 03:32:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777770002036277305 X-GMAIL-MSGID: 1778295659041191234 The following commit has been merged into the irq/core branch of tip: Commit-ID: 6260ecd04594360ae2af104fb2641317728a66e4 Gitweb: https://git.kernel.org/tip/6260ecd04594360ae2af104fb2641317728a66e4 Author: Kees Cook AuthorDate: Fri, 22 Sep 2023 10:51:27 -07:00 Committer: Thomas Gleixner CommitterDate: Thu, 28 Sep 2023 12:25:31 +02:00 irqdomain: Annotate struct irq_domain with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct irq_domain. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Signed-off-by: Kees Cook Signed-off-by: Thomas Gleixner Reviewed-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20230922175127.work.214-kees@kernel.org --- include/linux/irqdomain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 51c254b..ee0a82c 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -174,7 +174,7 @@ struct irq_domain { irq_hw_number_t hwirq_max; unsigned int revmap_size; struct radix_tree_root revmap_tree; - struct irq_data __rcu *revmap[]; + struct irq_data __rcu *revmap[] __counted_by(revmap_size); }; /* Irq domain flags */