From mboxrd@z Thu Jan 1 00:00:00 1970 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 DDB55C433F5 for ; Sat, 16 Apr 2022 19:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ziKbKw/sKwS8PSRKFxcTnzcSH0Pr7NutHwzodRJgpL0=; b=LTjCRuRREp+AeW d1tEBVUcfajKJI8UMz+Mt/e5uuB2Ur2NC05ywV0NfpOlOI9lzLKUR/iJ8r+BAlT0fkwtHL/z7N7zJ ewBfBAyIVFh0vmqbyD35M8W3/H/P+Tp3+loOlCffsYId+wUiSOzRDB0+DKHLD03ZvshIH1xk/+he2 5ZJ9F2GNkaycnPFPXsjbql4hKKkKLX7uWA4eYngKYfMZhXiYssv4YHaJlp9v2EQYq8O3yTgWvFniL xvDO80Gy+GW5VNSfmh6e8R6MMbO//cmn/yVI2Hkntmsm1RfvOFxWnLFOSTFwJqsHds4c89qXYzLWR bvUSNCRcUwPas0rDTiQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfoFo-00DQsc-M9; Sat, 16 Apr 2022 19:38:44 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfoFl-00DQrX-4I for linux-arm-kernel@lists.infradead.org; Sat, 16 Apr 2022 19:38:42 +0000 Received: by mail-pl1-x62d.google.com with SMTP id n18so9546078plg.5 for ; Sat, 16 Apr 2022 12:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=1Od2+V3Bj00Er4Mva8kO5nsmL4Z8o4xlw5ojaMLjb+w=; b=FFOQGdsSjPmsDdXIlaewKQ8ZFhhoraD8wn0k1G/X2hv94hq9geZz81UYFVS4QYEjw2 btSOypwjHN5ovugpJYXXuzgZu9we+zRymba667F54uMiM4CMybbNf4RHA5IWRYHtsNMT F5YBX+bTf6CoSIKm+3JVthY0Cchzo9cOliLZ01HWHYAX59s02cO9El5NZakqvkNABfSn lkszACXmfnj9J5YZIp6tae1eh1D8pLBHppOwp9JcmCIjSyQ0HwlBy5N6bdR0Mtnpxj54 XAv9mbIWjOYBnR9di3tXENZ1YPh5wbAYUNUVVx8cvR74hs4VGWCyH9sxSPQ2MZF+HxoH XcZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=1Od2+V3Bj00Er4Mva8kO5nsmL4Z8o4xlw5ojaMLjb+w=; b=TseuO6uJYdvt03XX+wpzFfyAx7xSqQjTKvuD1KqVqg4lsqP+RZDy8RExbA4j4RZiZ3 vqBytKXpaxwegLc7ZlCJbujC9C+OcMydSzNVpEYYXtM3+cJbd1PT1ytcNdHb9SwZoQLl zyrrVvd1zB7oXV0B5d9Tw15s9nMPdamHrwMxrZ+wh6wqbW9/xEUIjBmQyfhNK+F6hxSE pbCXGiXDghH2fX67rP5zgzgVdKGgyi/kdlwDnjNbI1H/t0wFEfgjV5mlsd/Avy34bfQ9 PHWra65viXKKJhJN2sJxawanMQPL3g0l7oHB+faBk23NoY6iq+D6iIP0dmvWCZmwubjE GrAQ== X-Gm-Message-State: AOAM530M6ig5ajkJWG9zU8D+j3N0oknbwqlZO2nqHusbzL7sfURjOIKl MKbVAKO1DzpUCW3Y1DP2PWY= X-Google-Smtp-Source: ABdhPJy7mlYg2xknqTc8SqONg+1saF9q0f2T6nu61MenY84/BMYT2pB1OyS1ut0gOcOlm4Mvl8AMzg== X-Received: by 2002:a17:902:ccd0:b0:156:7ac2:5600 with SMTP id z16-20020a170902ccd000b001567ac25600mr4631387ple.156.1650137919166; Sat, 16 Apr 2022 12:38:39 -0700 (PDT) Received: from [192.168.1.3] (ip72-194-116-95.oc.oc.cox.net. [72.194.116.95]) by smtp.gmail.com with ESMTPSA id g15-20020aa7818f000000b00505ce2e4640sm6678733pfi.100.2022.04.16.12.38.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Apr 2022 12:38:38 -0700 (PDT) Message-ID: <64a9fc32-0288-d142-f35b-0f688a0a6659@gmail.com> Date: Sat, 16 Apr 2022 12:38:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH net-next v4 06/18] net: dsa: mv88e6xxx: refactor mv88e6xxx_port_vlan() Content-Language: en-US To: Jakob Koschel , "David S. Miller" Cc: Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Vladimir Oltean , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Ariel Elior , Manish Chopra , Edward Cree , Martin Habets , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Jiri Pirko , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Casper Andersson , Bjarni Jonasson , Christophe JAILLET , Arnd Bergmann , Colin Ian King , Eric Dumazet , Xu Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, bpf@vger.kernel.org, Mike Rapoport , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." , Vladimir Oltean References: <20220415122947.2754662-1-jakobkoschel@gmail.com> <20220415122947.2754662-7-jakobkoschel@gmail.com> From: Florian Fainelli In-Reply-To: <20220415122947.2754662-7-jakobkoschel@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220416_123841_225502_9DC2B691 X-CRM114-Status: GOOD ( 15.23 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 4/15/2022 5:29 AM, Jakob Koschel wrote: > From: Vladimir Oltean > > To avoid bugs and speculative execution exploits due to type-confused > pointers at the end of a list_for_each_entry() loop, one measure is to > restrict code to not use the iterator variable outside the loop block. > > In the case of mv88e6xxx_port_vlan(), this isn't a problem, as we never > let the loops exit through "natural causes" anyway, by using a "found" > variable and then using the last "dp" iterator prior to the break, which > is a safe thing to do. > > Nonetheless, with the expected new syntax, this pattern will no longer > be possible. > > Profit off of the occasion and break the two port finding methods into > smaller sub-functions. Somehow, returning a copy of the iterator pointer > is still accepted. > > This change makes it redundant to have a "bool found", since the "dp" > from mv88e6xxx_port_vlan() now holds NULL if we haven't found what we > were looking for. > > Signed-off-by: Vladimir Oltean > Signed-off-by: Jakob Koschel Reviewed-by: Florian Fainelli -- Florian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel