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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78530C3A5A3 for ; Tue, 27 Aug 2019 10:15:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 553B920656 for ; Tue, 27 Aug 2019 10:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728749AbfH0KPX (ORCPT ); Tue, 27 Aug 2019 06:15:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40990 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726278AbfH0KPX (ORCPT ); Tue, 27 Aug 2019 06:15:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2C72308A9E0; Tue, 27 Aug 2019 10:15:22 +0000 (UTC) Received: from wlan-180-156.mxp.redhat.com (wlan-180-156.mxp.redhat.com [10.32.180.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5946460610; Tue, 27 Aug 2019 10:15:20 +0000 (UTC) Message-ID: <1a78da3c526ef6e631cadd39c596aeabbcb27ea1.camel@redhat.com> Subject: Re: [PATCH net] net/sched: pfifo_fast: fix wrong dereference when qdisc is reset From: Davide Caratti To: Stefano Brivio Cc: Cong Wang , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , netdev@vger.kernel.org, Paolo Abeni , Li Shuang In-Reply-To: <20190827115031.43fcbac5@redhat.com> References: <0598164c6e32684e57c7656f0b8aca0813c51f42.1566861256.git.dcaratti@redhat.com> <20190827115031.43fcbac5@redhat.com> Organization: red hat Content-Type: text/plain; charset="UTF-8" Date: Tue, 27 Aug 2019 12:15:19 +0200 MIME-Version: 1.0 User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 27 Aug 2019 10:15:23 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org hello Stefano, thanks for looking at this. On Tue, 2019-08-27 at 11:50 +0200, Stefano Brivio wrote: > On Tue, 27 Aug 2019 01:15:16 +0200 > Davide Caratti wrote: [...] > @@ -688,12 +688,14 @@ static void pfifo_fast_reset(struct Qdisc *qdisc) > > kfree_skb(skb); > > } > > > > - for_each_possible_cpu(i) { > > - struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); > > + if (qdisc_is_percpu_stats(qdisc)) > > This needs curly brackets, as the block has multiple lines (for coding > style only). If I well read Documentation/process/coding-style.rst, at the end of section 3), this rule should apply to loops. But I'm fine with the curly brace here, if checkpatch doesn't say anything. I will add it in v2. > > + for_each_possible_cpu(i) { > > + struct gnet_stats_queue *q = > > + per_cpu_ptr(qdisc->cpu_qstats, i); > > And you could split declaration and assignment here, it takes two lines > anyway and becomes more readable. ok, I will do that in v2. thanks! -- davide