From patchwork Sat Jul 10 19:25:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 472620 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=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 468C7C11F66 for ; Sat, 10 Jul 2021 19:26:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3553760FDA for ; Sat, 10 Jul 2021 19:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231728AbhGJT3V (ORCPT ); Sat, 10 Jul 2021 15:29:21 -0400 Received: from mail-bn7nam10on2110.outbound.protection.outlook.com ([40.107.92.110]:51932 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231184AbhGJT3M (ORCPT ); Sat, 10 Jul 2021 15:29:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vl9RmSwFX0LoSZqJFOP/NBycuQkv+QYiLSUm2vI73uxHM1xWNEBau2NYYIG2t4UCQcWfv/WgasoqySU9j9VIBbSl7JOL0yJdzLsml8pP6yrSUPpp6oof9YIGm8QtozTxIhKmGxih5koCgvg9gk0CidX/se1FDuT1CGdm5fmD4xNBz+AuD99dLjwnWzvb/EyAyXcoPzFTz3UENtHuYZJAInFQvku8v/hzEzdfyQEZ6nsnBYUKq8dYF1rTrNElnviKrfS8PMYvjM1/6hsJRcbJYOtr7q76cOeq661mZeTg/YfR9eIk9yZNzz3FRUIZculIbcFdKrDKsQs9eFlJXGXckA== 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-SenderADCheck; bh=aCPo/unyFkF2zHAE734bCvqx6zKhLBpbbjT0QENzyR0=; b=mqcqH02iZMj4ANck69ApfyeGcAfk1i7y3+tgn7yaUyb+RL3+Z6Pzl7Qd0bG4xRhQ/NeZ3yj8nD2brgcQcgTjPHHYC8wme7P74L6ChE+FK2xG4xlOF9fZ6XuXFK7g/BNkFnWleKLxRgQqE0MHPLXRIsQHI6tS6iX6kw/CQiDqncAiMN9NloqVZmIXaG0bqJ06TJBM22WZ0FP+vOdNxldPCOW063FHRWMUe7ZboG0MhmD1yYW01Te6uC/DSqzM1xYHHW5i3sL2Z8m80X4txbDQuYSxcsjsreQsZqn0LzCoZrDm5NcvwvBZ6SuCTlU8RyomaDn8/dPVYa4kroBRudb/Xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aCPo/unyFkF2zHAE734bCvqx6zKhLBpbbjT0QENzyR0=; b=kWMy+5eCBWf2aFZn/ThdaRYXPBqZW9Chjn0VoAT5xZYPhQNpWmp2YFCI4QlfOI3XzWmJauj5TcrMVKUO/uIXkBR7ZZGKcHqQUV2GWB/CF+Q2Ti5aZ4X+EyU1mjRA/yOB8QOp+yN3HP43gBhXAN0GvJ90D5FunApQnEiL5YhT20w= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none; lunn.ch; dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MWHPR10MB1709.namprd10.prod.outlook.com (2603:10b6:301:7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Sat, 10 Jul 2021 19:26:18 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::e81f:cf8e:6ad6:d24d]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::e81f:cf8e:6ad6:d24d%3]) with mapi id 15.20.4287.033; Sat, 10 Jul 2021 19:26:18 +0000 From: Colin Foster To: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, linux@armlinux.org.uk Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 net-next 3/8] net: dsa: ocelot: felix: NULL check on variable Date: Sat, 10 Jul 2021 12:25:57 -0700 Message-Id: <20210710192602.2186370-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210710192602.2186370-1-colin.foster@in-advantage.com> References: <20210710192602.2186370-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR12CA0042.namprd12.prod.outlook.com (2603:10b6:301:2::28) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.185.175.147) by MWHPR12CA0042.namprd12.prod.outlook.com (2603:10b6:301:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19 via Frontend Transport; Sat, 10 Jul 2021 19:26:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b4e773c-a08d-49b4-2812-08d943d89769 X-MS-TrafficTypeDiagnostic: MWHPR10MB1709: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YaMnyVj3dJwc6LtcB7oQXGDuUxAPY84W+P+Ftk/40lSGj5+4A5Q2wAfRr26I+EnaXI44XN5j0W3K7nowHDL5VvpL/znAJgIUid4qmrvPnX+7WgPaYjTxva/wf9wuuesFgVov7FA8bwODi/gZgWLzhwU+HtvFHnqrRxqKb6KtNp1lIYGCYaCoY+AlWb8upPuGUtIm9ExgxDifXgZpyjhyWgoS1rFRVjVzdY95GRplupJrTkOUVVfIS9PPMjpDi9RrRvD3j7+o5rapHEUC2MhwvB5Bcp/JC+1tszrkjD4IWM7DXiKGhho9xpYmLWvGkJp/FpMFa+UfxdqqfesalCIHYVNr0cdhNEDwgJ9AVqDnIGlJMmH9jaFXPtSy6XKYDeenf58aV2E4P9F98KmzJHSDi4ABSlWWyBvN+QAmNqdlg+A0OBn6c5Kc3NQicemxmhPtXXAIkNjAkkE50bJiCC5G/H16eTjpADleA9shZuIwvA+jf7G5e/T2i5CxFXbR/HgaUIqZldj6mYDm8gZ2dnT280AgpRxN5c2dKgO2gXD7KCl16HT8bNssoX/sFAB23AW58DBtQQtAVc/f9CFwXz8njnX+b+r305G2nyjx0mJpE/5Pq7cs/EOpqCZHU5rHVj93aB3MAoHR1TrIv4Xz0M+dbwzJuMnuvGEPIHb+anWVkXzgAXNaNtcAIeD0Y+pBzfMiHawewWS9EBuRBoDsbF3edidpTeJvDVcAntFMuwGce2w= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(396003)(376002)(39830400003)(136003)(366004)(8936002)(7416002)(6506007)(5660300002)(2906002)(66556008)(26005)(2616005)(8676002)(44832011)(6486002)(6512007)(66476007)(6666004)(38100700002)(38350700002)(52116002)(66946007)(921005)(4326008)(956004)(83380400001)(1076003)(316002)(36756003)(86362001)(186003)(478600001)(4744005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O/BF8q+QUfqTpxAh1xc/wey6Dj7W0x4kAF6cGoJGQvgXCp0Kw/Qk+0EPlLb8eehVgMNXFumxbS23xwspoPUJRZnECne91CrkyUWX4AZCkD8dEB99um79mj9e2zZPL8/a3mjFxCY8vj+qZChL2yQFnK+quV/9pqdkXKEBdm7k4YUixIGBUc1BjMNm164k5rPJs3mFwAHgsK13sFHpzQjiq2ijs4UV/jfhbhfGdIp00VEqhgVHPh/1m0npm9bmQrhgDwZydSaIl3fyyManoVIIWNv4OwABZeDpo8/9fMx/yPhR8ROgjmxop7Sat0MsG06cDCEhYTlbDgtGVGbPZCfbxZ+Wh1YpoOkz4zPBl/zj7hA3m5LXkT+4oij30CclS/ZuSl2K8mASRz2PaLfojiXJR6kT4Mb9BmRVJ1ue1DOu+IHmhFggisctwRrNI3+LVaWKePe3zUxFEAgIpVAmqg34NkEtMz9hSBRw63CLmZdifLrjsm6T1tGXoGBjnCKYZwBYjxi9sKQFYFYHYJqUAYciYrGL06oqGxvPotcDEbd1zRXoUs1v9c+qH1rctNsUzeKqYff6Tzu4AdZYgGb76EQy+/+XvlCif/31vnHYly0uY4VGHWNtGq+1wYO0m13qac3IUWBrNSAcJt4j8Cb5coLvJiAi4RVQliLOCwVBlwKJUd3xYAz32GXKicPFS4nQ+R/OIqpjN/6uvn366EFJLpWdDW3xrq9K4s+DmLWS3MSLvUtya85V70WslBUIdGItRgQHlj07VhHGOq85ARYx7Ii2zr66fdVyUqEKJkbl9LBrCeyQ105TlQbo0WmsD0Oi+HputQi24a3LDgEgpSsZmxxGC6tOTHQn3/zyb1QAWw/PBlF4OJ/+nJKpjMZ+kARMJGXFyjvbP0l7S8HdZGyqxEnlLdxU/hRx6HbFc9DGkLy3GwOwRL0iOIq9F0Rb881aKT8VP8RwsqULQVfRNIBZSgWUd9XJa7FLywHgipf1VGkOXOwb50YdeloWFCkFbg2i+MlrqZQntWZjf23YtNWpH5ZwOVpBrgvpveMm0e7hJJBnuALpzoT0+6Rp9B004paR7qYa8wudTa7gSRSDSGFxT1DzjY77OLLo9qCKP6bI1TkRIFtzIFNtreGYihr3h1SVDcFU+45Ek5h7rggkcEN62NGIuRdgqsc3UiY2BCoK4nfJXivfsHpUCUNbmqRRu2V/RbjKeV1e8bAbc7mASBnKST2jxGyH4wJvjozOaAS6sPweXZFiX4vbssbwq+9Z6OI9g7VQ2FhGB+RX1gpTHu7TzXFUSHmimwK2aC/yHyE3dzqD1Jyp14AVijngTJgDq5haUmpg X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b4e773c-a08d-49b4-2812-08d943d89769 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2021 19:26:18.3682 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YY6fX4+QaVndHUbcpS32iqisWGjg/roqKVv/F5/TGSdCXxAlv2d9vyR9jt23Kg5i+MUtdYVhjYowPFmWEUsNp2CbBHGm4rbHQH2uhNv9bkM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1709 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add NULL check before dereferencing array Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index ce607fbaaa3a..74ae322b2126 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -852,7 +852,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, struct felix *felix = ocelot_to_felix(ocelot); struct dsa_port *dp = dsa_to_port(ds, port); - if (felix->pcs[port]) + if (felix->pcs && felix->pcs[port]) phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); }