Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp684158pxb; Thu, 17 Feb 2022 12:22:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkylW/TR+/Zy0ayV4O7lvHXpQv6WvRRAccg/VQUiXciSnvcA6T10lrBah8ITDxhKz7Mbmb X-Received: by 2002:a17:90b:3b88:b0:1b9:31dc:adad with SMTP id pc8-20020a17090b3b8800b001b931dcadadmr8930118pjb.159.1645129338614; Thu, 17 Feb 2022 12:22:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645129338; cv=none; d=google.com; s=arc-20160816; b=tdGnMdm375YOiRw2KNwprrUSlE7bEQYF/eTmrXv6fWhFFEaFbYmjFSsQLmrY4MN1Dj d/QKh7RKOQ8zke+I23xhiEKv33SGutgtb58jd8PsJOzLQNWh5xtLBzvxbdLYLwWPB8Ea GU/Xbml8UAoRy7sXzRerMlc6Hl9jYOAO4p4zSPrHUd8ZjcHLRNbniAwEblcJLrI/uLJM i3S4k6OaN0gCuWMrmWQou2pf8NrC+Pts29l9xv8kLvF7a5Q4MzCDQ+/r+yf7EYM+Nd05 5s0QQWGq7z5V3jq/RzB5T/hOS6abNG1J1IqA2KAM+UOoNtCIDc4786qI3Z9xv75UfydL +SKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/E7vDJlr3ShCmm14rXXbmLyiW36foVXBUCP88CYbZEQ=; b=l5vxThceotyar5aSFpF0V1yk/iu2SUCEVS5IyQajqd/cB3GD4M9bzOeDYQd+ifblbA 99shN0RWCdIrdHZLcQeQ5hEUPZmCK4Le+kpKDlrCOXizzuQ4PXP72YInA2yvh7Q4GhB+ CsmwdAGKRLRuoPig6/etGH4Bnby3rn3G8dqU2xV78YFPfzyUhTRlSE3JcN0E0dpfdt0/ cDFaMDbBleWMmiMYhOyObQbBHgeB4tdLarv2vukehDtQ3VYtMYXMR0YqZaRH86sIoRWe h1Xvez+YgjJ+r5fPMPQaeZrQoWOmsa8/FlhmD9a+6Ap+V7aT155jg2MWjkBeLH8L9ksF k0xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UZNPaJbQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h184si8473314pge.208.2022.02.17.12.22.01; Thu, 17 Feb 2022 12:22:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UZNPaJbQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244795AbiBQSus (ORCPT + 99 others); Thu, 17 Feb 2022 13:50:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244659AbiBQSu0 (ORCPT ); Thu, 17 Feb 2022 13:50:26 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BA2532E5; Thu, 17 Feb 2022 10:50:09 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id z22so11335916edd.1; Thu, 17 Feb 2022 10:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/E7vDJlr3ShCmm14rXXbmLyiW36foVXBUCP88CYbZEQ=; b=UZNPaJbQTUyjcPbr/PNBbpLXQRT7b7gb4jnh8EQAYcDSaxNcnhmHXvL8dFXa4HwFff ZBW0wACsTlHyQ5wWSmgJ8NQFgE5BWKRMrVIO+2Pt7/v71HX2bJUwn/ThGTRtJRQHdq8b 1CXkbmgbaAqofVAMOW6tWeegzhzQWbcwr/6PAhz4+hoaT4+ZNlG+l3+M2wVNdBZP+yxJ EPKctpk/bEedKWCtPMie0yZpg3BEuwbXeUSp+anEzwJcDIs5yfUJlRgncigJx+4Hvwvj Hdf6JRkQMBsA8wZmeLAYbs1SdpbRoq57z/xUVZA3zyOh3BM/9cPhu72bRO+3bwX8a0+h Xu3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/E7vDJlr3ShCmm14rXXbmLyiW36foVXBUCP88CYbZEQ=; b=sFsDuocLH5gct/BUFdeHOd28HsemhTgH6PEQDXRNnR8FJaAf8/nZ1ZCsNz4Q/b76m4 r+XRFzxWxMdm4l9XrOX8aJsnbPoEakH2QBE0Yb9k9Kua4XRpjPWM2RCd+9YYopOzh3Yd LLjmYC6NtCLfLJGemUmsNDaIOBw/YOVEe06kPeVtCooSECGzM6g+eyLjXKl3amG1dAmq ntXHap80y1UIDxjHR3KQ/xh+HHKDmslcYDIC5RwQrBiWRCNjpAFfzzvBeEqaAcOFzTkM viOvMmBmYXR11ccTuYLTKrjtgzHBAf69pBjEtnHfbul8b5ZLWrJ8c55hsTQCc4AvHm9I DVlw== X-Gm-Message-State: AOAM532d7r7sM3ISFLGLOgg7U/MX6fNW6kugBPrdqIasGXmeaO1ywLxg 1TaOqWRbX5pv4N/A4KwMv6SsCEsj8SiRxEgC3GJMoQ== X-Received: by 2002:aa7:cc12:0:b0:410:cb7b:a9ba with SMTP id q18-20020aa7cc12000000b00410cb7ba9bamr4125709edt.196.1645123807668; Thu, 17 Feb 2022 10:50:07 -0800 (PST) Received: from localhost.localdomain (dhcp-077-250-038-153.chello.nl. [77.250.38.153]) by smtp.googlemail.com with ESMTPSA id q7sm3493268edv.93.2022.02.17.10.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 10:50:07 -0800 (PST) From: Jakob Koschel To: Linus Torvalds , linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Greg Kroah-Hartman , Thomas Gleixner , Arnd Bergman , Andy Shevchenko , Andrew Morton , Kees Cook , Mike Rapoport , "Gustavo A. R. Silva" , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel Subject: [RFC PATCH 10/13] powerpc/spufs: future proof usage of list iterator after the loop Date: Thu, 17 Feb 2022 19:48:26 +0100 Message-Id: <20220217184829.1991035-11-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220217184829.1991035-1-jakobkoschel@gmail.com> References: <20220217184829.1991035-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 With the speculative safe version of the list iterator spu will be NULL if the terminating condition was hit and needs to be reset to spu derived from the head, before returning spu. Signed-off-by: Jakob Koschel --- arch/powerpc/platforms/cell/spufs/sched.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 369206489895..5b2afda1653d 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c @@ -384,6 +384,8 @@ static struct spu *ctx_location(struct spu *ref, int offset, int node) } } + if (!spu) + spu = list_entry(spu, ref->aff_list.prev, aff_list); return spu; } -- 2.25.1