Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16816537rwd; Mon, 26 Jun 2023 15:55:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6LDaj9BUIA69bP5AnZGZn9sVZ4Jbj4f1rWvOc4/c3kwUwl0UcRqXR2hD5v6mD/kuHE7aR+ X-Received: by 2002:a05:6a00:230c:b0:66b:acb4:de39 with SMTP id h12-20020a056a00230c00b0066bacb4de39mr14091201pfh.15.1687820111836; Mon, 26 Jun 2023 15:55:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687820111; cv=pass; d=google.com; s=arc-20160816; b=fNOePVYS2fyIt/RbLDD/DpoKhMTakh1wMNDBlpT5tfyBqiifE8fDPfkpsWmiEsSq4H +NfhH+2pGSrpGrCAKL1AOk8dYUJ9+LLVmskeBl2QRlwXGjd3Ooyj4+0IBQGjOmN/INgR 3GzMJU536wZ8iKiQULgEKzmgm5l2AKukkIn7T0/XDrFGFI3ZRI+4JxtB4lrZudO9REKM BJhxMwonIzf/hQwyjR4N7PoVLimblC6AQ92l0SXWoSqwTJ5i63iBzF2Zy5XNoJH3/qYC ut/o2Z//nADxEkVaa1cf58fGnuHE+K0RLFrN8A9vsrr40QbI95E996UI+WeIiIhzgxJ3 zs5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9kI/gw8SKfiSKqDR8uaPmeAjHZ7Lubzqvx3MLZko33A=; fh=y9p9nzKdzpKprNHcl7/EYub8ummKaxfkqZ4KTVjZFjY=; b=ADe+VxIzKKa/eJWZvQb9Z6P9p5jdY/6H2oP/S5+hgzh8XCbHfve+8iK9xHNPL4iNTi ptX/PA+IfOXzLS05NLaTXSzCFb2OQeCozrBYoV2X6/3s4ZVdkXg6KRB0FZAs/RvtLppa lSRTBcSlvGtHUjJt83328IE+sKT9tSZ+8KfwY+6Q99GHy3bxs9C+fsVxBq0bbBUFh3Id Wf4gYVUugmCDrKEeyt0yAvgyDSSN989iUSmna3egy+1/CHT2A7r99C/CNhdV+xW60HP6 xFKRgSomsWrMBtBm6ceU/1kk66yvAl/3zzw5hQHX2ilxIK3S1rQUtIx/HcYm0MTr8nPA v3gg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cPlwX+aQ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a056a0010c400b00657e27bd74fsi5906155pfu.253.2023.06.26.15.55.00; Mon, 26 Jun 2023 15:55:11 -0700 (PDT) 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=@nxp.com header.s=selector2 header.b=cPlwX+aQ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbjFZWSh (ORCPT + 99 others); Mon, 26 Jun 2023 18:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbjFZWSg (ORCPT ); Mon, 26 Jun 2023 18:18:36 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2086.outbound.protection.outlook.com [40.107.105.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1492093; Mon, 26 Jun 2023 15:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l4K66eRMgiGjcZ9kFrm/Qhd89fCsCCddBetkLxfyrIahJHVfkDB911lEzXOfm7zyKdHY9rJF54s6mLepS0Sl7gfSrRL7yAuMRwiRmi5zRCcuJaIgBPVtGRqLq30Tx1O/WmIYGwIjw1NjVIMz6+o18nBP4LB4PlLTSJXHXS4WeuqRF5amPrhWKI/duSefj1NO4cI9og5BEOO48UQV6bp7tdKFgaYfI5k9zw3s/GQSWInoZglefMKqJDECay+4E37Cn9/heHWQXf3PEsj1s71EIo6xDpJvruDS3KMxzPvy4RNLmwiJdMC7702qUC6fu+NfXk2ZpXqBdoDk99x5V2Wlsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=9kI/gw8SKfiSKqDR8uaPmeAjHZ7Lubzqvx3MLZko33A=; b=hLxdAbgQ73TKCd/oQUe23e3UCZKoScOX3loT23nVq3zeXZo90MQecpjG11uAvlbMh20XIcg+Km10RI48nGA7g26RlMX2J+DAhyEAh9grcl7mXcDy4QVwUJTG8Y4B2Kky/ClQ6KOTglZaH8bFGwPVoOrj2F5cEcOugt/1YHqsWaxF6NBDclBgnxGSD69qCdz1celBsFYKjQP3NaehkXUs52BrXkU73+7bynxON+nI4zAEIs3m6efZjpvW1r96/mCIVDo0CI4iWDTUsFWw/NOffLmHMDyPZO9hCZGO8hGZ1xTuKLlqDfvyHn8xKZbccMJ8b5hVzOXF2oqHXzEhUGZy4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9kI/gw8SKfiSKqDR8uaPmeAjHZ7Lubzqvx3MLZko33A=; b=cPlwX+aQJ+YA7PVB3lNUtU3ggIaGdYDb4Hg82FLVjzVeIJ7mlaceT+Xf7CCogll0V/v0qyoVFgq0bI2vR0xEyF4TivKY7xqB8onNaxvd7vzUTU7SOIsulP1fsYKQjaw/EH0DKWCQG0bbYV32jlFvavacqADy0jQsTN5f/nLVT7Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8306.eurprd04.prod.outlook.com (2603:10a6:20b:3e4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Mon, 26 Jun 2023 22:18:32 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%5]) with mapi id 15.20.6521.026; Mon, 26 Jun 2023 22:18:32 +0000 Date: Tue, 27 Jun 2023 01:18:28 +0300 From: Vladimir Oltean To: Simon Horman Cc: netdev@vger.kernel.org, Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: Re: [PATCH net 2/2] net: dsa: tag_sja1105: always prefer source port information from INCL_SRCPT Message-ID: <20230626221828.qzjeo6dedjnyme6k@skbuf> References: <20230626155112.3155993-1-vladimir.oltean@nxp.com> <20230626155112.3155993-3-vladimir.oltean@nxp.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: FR2P281CA0100.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9c::14) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8306:EE_ X-MS-Office365-Filtering-Correlation-Id: 43c6c987-da5a-48d4-b80d-08db769346d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9cCsSUwNI38JfP77L8NCtt8AWi2GNrTSKSKW8IxE1o4vRt91+vqshKxpr06vTBeLiZWhPx53QYzuV8hmwrXDTlbXZ0VS/o4rjpnX+qmO0KlcKaDXu4CTk0tNhQt7d6ksvCYFhOAHnhWN6rn/DN6/56PyjcUqpc4zOUuzxwITGK3OyUmaM/4NiiqgkzwXD8o9yiE8nZLwTVja7Y1iAbURAoAzIbLX81cD6j3TRwbc4ASrtk8Wmnm3ZCjNfhOtmHbKXh3kxeJVOP+QApn1xTEKdGkLqJhrkksrtUu6IprQyvurcjuzae8Dcy5l0E5Bk77lHFd1bdCSKWFmyoBKxJXTABMXDdvSIbk+rUupJMBIHEMDJNuL9pQdcZWgVRnK3Lf02AGj+ij6lPVklEjLpv5AgVLM4sn2RhWN/EDQCl9+7lsomvkMa+UsWBAcjq0oG4tiVP9MOe1IKvR2XBUSJJwqftxo4vmIlEFwzs1N1qFMdKHCOmIdoh243vB2BegL+aasGneQqSDgi0LxM9KWR2LOR6c7kKX0pHYMv8Q3e4rhKZ8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(4636009)(136003)(346002)(376002)(396003)(39860400002)(366004)(451199021)(26005)(2906002)(44832011)(186003)(33716001)(8676002)(6666004)(6916009)(478600001)(54906003)(316002)(966005)(6486002)(4326008)(86362001)(38100700002)(1076003)(41300700001)(5660300002)(83380400001)(8936002)(66476007)(66556008)(66946007)(9686003)(6512007)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?L6/wY2FbVXYPMQgCHGLQUJ/tKNr3ujAGw6vR9i824SzgG1dQ0sqrcb7TARFk?= =?us-ascii?Q?cDWZ8LspCiFXWuppJucv4Oq8DRT/XuvfmhAU5xrbNeWNcugAugCusLPINE/Q?= =?us-ascii?Q?VfHito+tDxpajsPC/j3/U3LOWOOen220QBVWROB27iI7o986hDQpppECU+Xf?= =?us-ascii?Q?C4ZHq+w7ZVhqWkf21YrHqb2vaoIMcY5w+PjiQhNnZlePd6g7zo5IisvxQlfF?= =?us-ascii?Q?1ox1lGBeOjtzCFnYGrVhcQqy5JSf88NdmaXIByZ8i6uyW2ixEczrfrSu0bbM?= =?us-ascii?Q?Y43mr2Ccf7KEmgoiFrqmL0E1rh1uSvVeoMsffPzjcFrUIzpRr5bUmdlVUZ7F?= =?us-ascii?Q?e3zMhHjNRpDDmbVDWZwHum7I842h6XA7GlbJeAMI04+4XTqtHPIgcw41wau5?= =?us-ascii?Q?oHfh7naH2KM7z3dvEjPoxC/RGHqDj62bpQr/3waYX71QGrWflXccsiV0HqA1?= =?us-ascii?Q?3WcE2AT1CEYXQJqiE3srpXA4VcdnxOzodaZ3F33HRVXSmnvi+ypOx2h1PoFv?= =?us-ascii?Q?NgkJpMHknL9KBS01olOjg3re7/JQTDktIrVOcjaFlTJivEYWU+KLLKFVZBlB?= =?us-ascii?Q?W7h5I5CD5VbJtq1AQsENYl/yf+GLe5QhuCLHE2CSPBIcES1t1v1ZjXD3U9i3?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y4BDs70hgdSpT15hDzU5yS?= =?us-ascii?Q?olNEHRh/7k6bTN/qdP0VreaCvz9JpcC2xkHALZUkFBwpojcyrvLOGHESsMid?= =?us-ascii?Q?xg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43c6c987-da5a-48d4-b80d-08db769346d0 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 22:18:32.4769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IQuZDxkxmNHXffmciEGqPabriC5wdSJcndITsN1NNXnVkqashsuqf3PvM+pyy8EIBfPTcUAFAoaFUcGkSRJIbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8306 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 Hi Simon, On Mon, Jun 26, 2023 at 08:11:53PM +0200, Simon Horman wrote: > Hi Vladimir, > > A similar comment to that made for [1], though the code is somewhat > different to that case: are you sure vid is initialised here? > GCC 12 and Smatch seem unsure about it. > > [1] Re: [PATCH net-next v2 4/7] net: dsa: vsc73xx: Add dsa tagging based on 8021q > https://lore.kernel.org/all/ZJg2M+Qvg3Fv73CH@corigine.com/ "vid" can be uninitialized if the tagger is fed a junk packet (a non-link-local, non-meta packet that also has no tag_8021q header). The immediate answer that comes to mind is: it depends on how the driver configures the hardware to send packets to the CPU (and it will never configure the switch in that way). But, between the sja1105 driver configuring the switch in a certain way and the tag_sja1105 driver seeing the results of that, there's also the DSA master driver (can be any net_device) which can alter the packet in a nonsensical way, like remove the VLAN header for some reason. Considering the fact that the DSA master can have tc rules on its ingress path which do just that, it would probably be wise to be defensive about this. So I can probably add: if (sja1105_skb_has_tag_8021q(skb)) { ... // existing call to sja1105_vlan_rcv() here } else if (source_port == -1 && switch_id == -1) { /* Packets with no source information have no chance of * getting accepted, drop them straight away. */ return NULL; } This "else if" block should ensure that when "vid" is uninitialized, either "source_port" and "switch_id", or "vbid", always have valid values.