From patchwork Fri Aug 9 07:02:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13758448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC1F2C52D71 for ; Fri, 9 Aug 2024 07:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=z9ABY4WcgGtyrCiAZVFNiMwtw0Ldm5nr5WqR1vLi4Ps=; b=sckS6Ff5fTG5GU19mL8vp7k0DC 6Utmw4rE96BlzW3/shDyRcRuCc3rTnaPC4ncanZ8N6jnyKBET8Wtp9xCY/Khq+iXrMvMfJEZQRxWH W0Z39b8qQRlFB5fXdexq5GLzYJXuWP8LcV1mRkQnFDQoDklET89oR6i2LjNmOdbs/YKYpjxsAojTe 30O0YKQuK7iJJ2VF1AfRLdEtXPUlu7tXl9XarVXydPrl73dHsH8bo8P/O+6Ek3PX/N5raVr9EXAnb ZbU14jNjw64ussmr99spmTTzR+quw19GFr7oNCl84O+2nRfi8q58kFAuGtV3Z9lA9R+Vu7Q+JjEsp u8xKnY2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scJee-0000000AURk-1SvT; Fri, 09 Aug 2024 07:03:16 +0000 Received: from mail-dm6nam12on20600.outbound.protection.outlook.com ([2a01:111:f403:2417::600] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scJe4-0000000AUIk-1Eqa for linux-arm-kernel@lists.infradead.org; Fri, 09 Aug 2024 07:02:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=db7s+QNE3iVl30t4d7x6WbRvZfQyZg1rznlSDwsSrCYkcRkqW7uTHHVO6dw6b6Qs7lkg98bilOWK18aLid926o0JA13wgvpfc0TU3uMf5Ck4AQQxBsXiIZWtccxFidtHdKJs+hvNNaHbIg5uYgDHMv2sHCF/JKzA6K+0hj360+sWePnFO7jivdlIO0ZW18iT8fVErppi1sXt3nv3l6OfSjRs65JmmqYEu2S1vR06jYoTXj3t1D5+RTQbvGuYK7j15wo1er6qdy/of+xtGEp/qP8hpqFRig6docweLvKzG2IZe7ZJq6mavBqfUgF+j1OETVW3Ni8sunoAhc5wPmHrlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z9ABY4WcgGtyrCiAZVFNiMwtw0Ldm5nr5WqR1vLi4Ps=; b=tIpEeaGHD8dCoE000XETJStssceWURWkKne4ZCcRNAsNhaJIOZKpoK3vS4cusVWMO0a7izKqjOA/0hpn/ksYU7Qdhy/hTquZtDjHWPFNc0qAYKmMxN+MQDbFHIBKj0gy2LWWwj9XDfLNX1hOIlFl0Ok7bM4UgWu1cBo9WQnOhi2QkPnoNOZ5Fv7SYIsa+/PO4EoOZF6qhKIyv+nDk3c6AbKwvCHnLVWh6MiItTUnAn7koHaRdAaK4aA5rvfvDkNjZrnmE+n5YGm9yaJ3Q5LEShSIy5HEeYrGmz6OUMqaLRO8NUUqcNTS8OFI9B6dZPavXSDUagYnEDyaJsaTQKUVkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z9ABY4WcgGtyrCiAZVFNiMwtw0Ldm5nr5WqR1vLi4Ps=; b=2K2N4DdF9E1DuLVy874FXnsTt+f+Z3GUiPYyO+p/SskslTVM3bHvloKKFJndoL+sXsgy3a1Vsr57Mst60juElOLwrIVu2a6hKhu+L+/qnZQ+H6B0WivSbWqJLJDNKd+BaYhhdYBriB6jaoo43RpS4Ym23atLOvQQOBAGDYyZ1E8= Received: from BN9PR03CA0893.namprd03.prod.outlook.com (2603:10b6:408:13c::28) by IA1PR12MB7760.namprd12.prod.outlook.com (2603:10b6:208:418::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.17; Fri, 9 Aug 2024 07:02:32 +0000 Received: from BN2PEPF000044AA.namprd04.prod.outlook.com (2603:10b6:408:13c:cafe::9f) by BN9PR03CA0893.outlook.office365.com (2603:10b6:408:13c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.30 via Frontend Transport; Fri, 9 Aug 2024 07:02:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN2PEPF000044AA.mail.protection.outlook.com (10.167.243.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7849.8 via Frontend Transport; Fri, 9 Aug 2024 07:02:32 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 9 Aug 2024 02:02:31 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 9 Aug 2024 02:02:31 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 9 Aug 2024 02:02:29 -0500 From: Radhey Shyam Pandey To: , CC: , , , Radhey Shyam Pandey Subject: [PATCH v2] irqchip/xilinx: Fix shift out of bounds Date: Fri, 9 Aug 2024 12:32:24 +0530 Message-ID: <1723186944-3571957-1-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044AA:EE_|IA1PR12MB7760:EE_ X-MS-Office365-Filtering-Correlation-Id: d0a66f07-cf7f-4c0f-348f-08dcb8413d6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-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kEPSXFl0Sw/w/n78HZFkKph5ehF7m/lYI/kw0g8v6qUFSjuCBEA/S+EMsw1jct6lqtbXdkQ7C5G5P7sX7j6Kfdf1kU5Q0hD1cXK/hX4ejVO5Zt8bOW8n6HLpuicRWrwuxMmZslQgkYLTobBN1dXItsEg+c0iaF1LPDC7iPrMrEZOpQXyQpW73BWWjzXg1jX5uJ/m2HNw8o9JgYW8F4XRUO0mhTbdg0CHHCezS/5w9sjwZxcPE4Fcc/ZwUErsEShx53fYD/dRwIpG3vLXnWMJtatHjbgzkS/iOU5VSJkH6DpakTa4ozYm0crxKDWXdbs31X+/fHX4gt2Bd6jVl/hCU4qXH6tSUxzRiGgo18GStWwdT630ztaUKxWxyC+Qhy0kqkLsxCttnLUbWAetBVVv X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 07:02:32.0754 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0a66f07-cf7f-4c0f-348f-08dcb8413d6e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000044AA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7760 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240809_000240_367638_47244F57 X-CRM114-Status: GOOD ( 14.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The device tree property 'xlnx,kind-of-intr' sanity checked that the bitmask contains only set bits which are in the range of the number of interrupts supported by the controller. The check is done by shifting the mask right by the number of supported interrupts and checking the result for zero. The data type of the mask is u32 and the number of supported interrupts is up to 32. In case of 32 interrupts the shift is out of bounds, resulting in a mismatch warning. The out of bounds condition is also reported by UBSAN. UBSAN: shift-out-of-bounds in irq-xilinx-intc.c:332:22 shift exponent 32 is too large for 32-bit type 'unsigned int' Fix it by promoting the mask to u64 for the test. Fixes: d50466c90724 ("microblaze: intc: Refactor DT sanity check") Signed-off-by: Radhey Shyam Pandey --- Changes for v2: Rephrase one line summary and commit description as suggested by Thomas Gleixner. --- drivers/irqchip/irq-xilinx-intc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: ee9a43b7cfe2d8a3520335fea7d8ce71b8cabd9d diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c index 238d3d344949..7e08714d507f 100644 --- a/drivers/irqchip/irq-xilinx-intc.c +++ b/drivers/irqchip/irq-xilinx-intc.c @@ -189,7 +189,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc, irqc->intr_mask = 0; } - if (irqc->intr_mask >> irqc->nr_irq) + if ((u64)irqc->intr_mask >> irqc->nr_irq) pr_warn("irq-xilinx: mismatch in kind-of-intr param\n"); pr_info("irq-xilinx: %pOF: num_irq=%d, edge=0x%x\n",