From patchwork Thu Oct 24 18:58:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Thompson X-Patchwork-Id: 2001892 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZFYs1kSmz1xx6 for ; Fri, 25 Oct 2024 05:58:41 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1t432V-0001Ta-JN; Thu, 24 Oct 2024 18:58:31 +0000 Received: from mail-bn1nam02on2076.outbound.protection.outlook.com ([40.107.212.76] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1t432S-0001RO-ST for kernel-team@lists.ubuntu.com; Thu, 24 Oct 2024 18:58:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sTtstSGcB0e8QJ7IdwcqSkZjPifFKdVSSwcKMivrIw5zw4Ol7emmRqAnWf0N7q/tqFfqSKXfdXLPZEiPS3LLBZvbe4AFSjnjkn9eUmMoAlHIKQ202RLdabcBM+IHgjJ+aARe71psB1TM4wTlP1pKpUodY6HnhTb8KCI8cx7oG3VwM6bSVVbnU0M45F7nYTpK0rkDI1KEa8YmM8imX59ygd88cmD/tYwjRBb9LLTNTX1JAktQhsBEnvv2Ed62fXaDUJYBKakCbKqrk+lfJnSJhqNJRFcrFyaOq2338GxV2rMKLf3+rElQX6Yv+XkiNfJKvWb3HISq8J17vDV1a0mEDQ== 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=UMr67loFIJcWNHyaHiCUFSwYf6zuXUAya8qSVCiJWDw=; b=Jp6EbT8FKymiXBa7QPWNU6Qu9mDO4/d6tTMYv91S09EvITQ76nSrkf6dbS+KnLfzDrdEETm0qZf8MvioJ5H0Fd8bIjNSS5o9jMhIPFnKzHExpLwNOjszdckWDjrZ+ekcwDLMSzDm/tNby/P0ZG3pJh1Ch0U0BBtcB+zxanvvN9Wr2Yqt4aahcGhe36m2pnNw4ivdLkunLT7cFHDMgQe2LlQ3h4hdzIGGQxKfVNLShjzJ1nfVJKuoAqDgeN0fG0t0sshWzoUzfzHj8gpF75RwPm8X2Heume8AVC3zf3LwBFMeYBz3G6O0AYRRpBFzkk1WgUdBddP1RJAMJCGghZ6HvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) Received: from BYAPR05CA0072.namprd05.prod.outlook.com (2603:10b6:a03:74::49) by PH7PR12MB6395.namprd12.prod.outlook.com (2603:10b6:510:1fd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Thu, 24 Oct 2024 18:58:24 +0000 Received: from CO1PEPF000042A7.namprd03.prod.outlook.com (2603:10b6:a03:74:cafe::ef) by BYAPR05CA0072.outlook.office365.com (2603:10b6:a03:74::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.8 via Frontend Transport; Thu, 24 Oct 2024 18:58:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF000042A7.mail.protection.outlook.com (10.167.243.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Thu, 24 Oct 2024 18:58:23 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 24 Oct 2024 11:58:08 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 24 Oct 2024 11:58:08 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 24 Oct 2024 11:58:08 -0700 From: David Thompson To: Subject: [PATCH v1 5/6] EDAC/bluefield: Fix potential integer overflow Date: Thu, 24 Oct 2024 14:58:01 -0400 Message-ID: X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042A7:EE_|PH7PR12MB6395:EE_ X-MS-Office365-Filtering-Correlation-Id: 6412cf45-20bb-46b2-4e75-08dcf45dd5e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: c2D3qOEtCCztMhtRZSDXPj42vdqA0Vcwpf+WVb22KAh7nhg1eI+804s+8s5ctNOVVH7CrWuZh6t7l6xRyvGs3cqlfDPdLgHWJfM4h7GUslKkz2D7/9CbQhidO/9SHg6CfGXQOla9tOPmqv5Ia7SeSsZRfJ4aIwjlaGmT8EzZWCx0DX1z5i8jl2Nu5OPiLtFBfikw3ggQBb0CcSgfYCDaQpz3QyEkAKnOy9iLRBD8ppCIhsFe+9cpPr4h4+MUHg5/d4GcBVgKy5WEmUhpck0+A2oex8/DrZgwu3WDCPhGo+okvhFWu7dL6Y3AZI/MHRzcknIFLZt4yyOR9EgEDavEsroTUmUAdKA/naoh12A3vuYPNT83lsPTgMXgXXKO2zGZ4AFsOBP9ABbZEFHXM72MqpPrELi6TtjGjSWl8qpmshGoKh/xbUoWeoNbJBQ/vFe/TJrZMvmtPPowQSg2nQePcKNmkO+DK5scj06JznXdopDvVNdEAwrKF+warOcAG0M0eYUxiZmHHAId5ZZwAjCz45JAgfUMghj8NBopPWQFB8yoz57H/B5hZA+0QgQV2M2vFktTkyjeoHv113KY90008E10gp5fqg8SWgZ69egjP/sXVYpt0z0qQMwYMESb/Qa6YDDcRrMU0RU0KFJaPezhHERxySG+uNPUmxuZBCf6FUIl2nKwr8oUZw9qAfh7gIGe5Kv7eDobDqZiB0QPdSQyjgPU6ivaqkujYu0GERNVtPnE2h24Q/h67xySnUw4xnlAQjFJN+bm6pdMmViBGmp43Zti2yl4Kr+0nkwi6ZRyrmJm7T69IL9Kh5WNslDlzcMaj4mjdpickCfsVdRGfKIh1L9p/xWZ/ord29RT0z8wIxIdRGp0tHA9gIsx4SSc+1f+AENcmlrZ2MEoQ2hL+v416QMnVzvBNfC7QK2MTCbNh0b/kgO9JbMcjG0iU6CN5Ms3nyhon+nIccbIPfy9PeF0B2PAmgjs1BGG1bOC2JS7owdkP5Z+PscDJLtev/zltgSQ74BwzUdbLI06CmVAhdJLC8cSCFULxPgjMt8T2PzZg1a7PtBUCMLf9diuFOk8RK7BbgVNrr/bPFOFzxREJrM7J5+x5TMVz09H+4PoRjjkKaR9fo4hNxI4SAwzUsj8aTyvC9s7BL6721Gf6CLcAIx3tmpycjhwYTIG+yrUAAsBkT2UtbXUXipFQXsNByHIaRSEzx28onaEMP9YNQZraLsOc5JHWZ4SIRTKfsxLhKkccszgtO/0iias/GS6eI01qfkgueUQrWABhBKWGqJQuh0w8Z5/FxX7hBXTkNhxBCiLK0MvU3FZlZaqVwRH+T3vtiefZ9KG/BZCK4xruhXNl7vIeKHN8nWSmTToyGKlnUiy7Rs4RWDNS4+CWdWHvhjoXnuP6gKlu3Axl9/dr0iNg3CZyQ== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 18:58:23.6359 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6412cf45-20bb-46b2-4e75-08dcf45dd5e7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042A7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6395 Received-SPF: softfail client-ip=40.107.212.76; envelope-from=davthompson@nvidia.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shravankr@nvidia.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2085561 The 64-bit argument for the "get DIMM info" SMC call consists of mem_ctrl_idx left-shifted 16 bits and OR-ed with DIMM index. With mem_ctrl_idx defined as 32-bits wide the left-shift operation truncates the upper 16 bits of information during the calculation of the SMC argument. The mem_ctrl_idx stack variable must be defined as 64-bits wide to prevent any potential integer overflow, i.e. loss of data from upper 16 bits. Fixes: 82413e562ea6 ("EDAC, mellanox: Add ECC support for BlueField DDR4") Signed-off-by: David Thompson Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Shravan Kumar Ramani Link: https://lore.kernel.org/r/20240930151056.10158-1-davthompson@nvidia.com (cherry picked from commit 1fe774a93b46bb029b8f6fa9d1f25affa53f06c6 linux-next) Signed-off-by: David Thompson --- drivers/edac/bluefield_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/edac/bluefield_edac.c b/drivers/edac/bluefield_edac.c index 5b3164560648..0e539c107351 100644 --- a/drivers/edac/bluefield_edac.c +++ b/drivers/edac/bluefield_edac.c @@ -180,7 +180,7 @@ static void bluefield_edac_check(struct mem_ctl_info *mci) static void bluefield_edac_init_dimms(struct mem_ctl_info *mci) { struct bluefield_edac_priv *priv = mci->pvt_info; - int mem_ctrl_idx = mci->mc_idx; + u64 mem_ctrl_idx = mci->mc_idx; struct dimm_info *dimm; u64 smc_info, smc_arg; int is_empty = 1, i;