Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp393909rdb; Mon, 22 Jan 2024 07:29:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMynv8/fQDBoynkohjIaF3UFlfEEYM1Ypbm1cTJtJDRMbox2qSuex4RLZDk8v2dQQUZIct X-Received: by 2002:a05:6808:3a0b:b0:3bd:3ca3:ff0c with SMTP id gr11-20020a0568083a0b00b003bd3ca3ff0cmr6925907oib.52.1705937351479; Mon, 22 Jan 2024 07:29:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705937351; cv=pass; d=google.com; s=arc-20160816; b=FTeumrQBN+zCxqqzyLLgLmKp4y91mR/B1e+DpsTNo3g1KWHQkBcMLfITHoyZsFaSVP NxfmRZEATxxAsqmxQJjFKr9HTItQlxdacI41dXu0Lf8DFHxOl9NSmIH7OkNfjKMG/tEV rk9ffgepX7HiqJDlu69wReegjLbOfvrfnoXbPjTcyAlr21BubKefspDSHXHGgehdrS7I WR12f3yeTD42Nf6jYttCBS5FCcD+9zAEwhatOVy+Wtf1vYXWC44gv9yKaSCrWRZgsmlM Ekk17DsVhJErDo6XnttVPhrHybI61nPjflCUXjiucLnmAylV0uCcpYeW0GDPTXoKPTTi QmLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AxOAb7lIFInUyJcCkyEno4c1aKnMv7FWjyhIpbwgjGY=; fh=QXrTUYpFb/qvPzw7EVbu/o4943O5/RmtXAeskj757Sk=; b=q/6JBDYUA5gMIVNLNVFNF6CLIGZYPbD0x2PCqLQgfXCts8ei5CG00vU8w3vCMwWwzz 31MY5NwO2oFll/hPZG2eeLyXYSldeDbtAnRqhxLoSujh3AMhWMBflSbhBokm65+z/+LV wjVhoCSC0D9tznAAg9a6Pjis9tYV3biTxpHC0op5Bj03B0skY3uE8YGBFPriVtPQpYtS MqIOY/orQitN7IXWQJ0p2rGHBeiYh99I4HLqs2uOcKN75DWgnAjdaL1FO0GXrzY9IDMP a67VOkKEBWswVdVoImU8Ir8V0KAC5cNmbDbB+KXvWEEvEOmRCVqER5YQDA8w0Iorp474 6RRw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vApEiu8C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33304-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 21-20020ac85715000000b0042a40831579si2105067qtw.444.2024.01.22.07.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:29:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33304-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vApEiu8C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33304-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3CA621C22139 for ; Mon, 22 Jan 2024 15:29:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A4F75F87B; Mon, 22 Jan 2024 15:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vApEiu8C" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A71C45F868; Mon, 22 Jan 2024 15:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935722; cv=none; b=G57wvIk0kYKNqdiBxxSRSd7ZE3eRWdj2HfWsxJvkz0+5XL4yNdEdjIWF+478Ro9xWgU8WRIWVUELvNzQ0XL0tX4hwWraTGK0mOcXc57p0i1VBS60e+zu352Fi7C5YcS2qG+TBV+npZFJHIWlXEiz11NUpQc8g03IwCnysTP2QZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935722; c=relaxed/simple; bh=m3q+ToFjWwnp4WpJ/Dy/2htLcjii7Ow9i0kIm95oHuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IMyvdqNtmLSYJGngp2sXfyxtKrhjA2wryjvhz1ho2mBg9Rt7Md5p/T2TI5o99gKSXxEICuVw+q2T4KJsS1iYQvbfSNbHVyvCuYf0l7uSUTPmhOpkoSbjswlbKUV3fSA0tGatnR+agrVOQUKUoYLAvDPq5U8H/Vbn1/FrqlPjrcI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vApEiu8C; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB06BC433C7; Mon, 22 Jan 2024 15:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935722; bh=m3q+ToFjWwnp4WpJ/Dy/2htLcjii7Ow9i0kIm95oHuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vApEiu8CZDbT0UWpEKSuJT4fdK2xH6bDQReFXEALAbX66/UqWavRmgpnJhpAO3zs3 x5ebo1K85oN7wUnPyiUT6q3ysn2ZxtJOh5irWouLdfa6fkXIzdv+Dxi9FzoDofMCAW VsdBNm9lRxgAFw5ecCQJuKtBILOFDJlKbcby55InVJr9Wn2oXefqW0GP/7g/3HfItR rnuJmHu2HgXfYIF9DBo0MoEVZ8k1Xr/dwmM6ATXg7kC8hojgs9lDJfCjuSE/eKxtf3 o3U6lR4C0Fx/vCpabphL7R8v/E34Mkk2zMaezr/5B7cZRuQYbcVYW9K4rvQasEJ1tL XH6gch07DioaQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivasan Shanmugam , Felix Kuehling , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Felix Kuehling , Sasha Levin , Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.7 82/88] drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()' Date: Mon, 22 Jan 2024 09:51:55 -0500 Message-ID: <20240122145608.990137-82-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.1 Content-Transfer-Encoding: 8bit From: Srinivasan Shanmugam [ Upstream commit b1a428b45dc7e47c7acc2ad0d08d8a6dda910c4c ] Fix the following about iterator use: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1456 kfd_add_peer_prop() warn: iterator used outside loop: 'iolink3' Cc: Felix Kuehling Cc: Christian König Cc: Alex Deucher Signed-off-by: Srinivasan Shanmugam Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index 057284bf50bb..d18dff7bb889 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c @@ -1449,17 +1449,19 @@ static int kfd_add_peer_prop(struct kfd_topology_device *kdev, /* CPU->CPU link*/ cpu_dev = kfd_topology_device_by_proximity_domain(iolink1->node_to); if (cpu_dev) { - list_for_each_entry(iolink3, &cpu_dev->io_link_props, list) - if (iolink3->node_to == iolink2->node_to) - break; - - props->weight += iolink3->weight; - props->min_latency += iolink3->min_latency; - props->max_latency += iolink3->max_latency; - props->min_bandwidth = min(props->min_bandwidth, - iolink3->min_bandwidth); - props->max_bandwidth = min(props->max_bandwidth, - iolink3->max_bandwidth); + list_for_each_entry(iolink3, &cpu_dev->io_link_props, list) { + if (iolink3->node_to != iolink2->node_to) + continue; + + props->weight += iolink3->weight; + props->min_latency += iolink3->min_latency; + props->max_latency += iolink3->max_latency; + props->min_bandwidth = min(props->min_bandwidth, + iolink3->min_bandwidth); + props->max_bandwidth = min(props->max_bandwidth, + iolink3->max_bandwidth); + break; + } } else { WARN(1, "CPU node not found"); } -- 2.43.0