From patchwork Fri Nov 25 10:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13055758 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 97A68C4332F for ; Fri, 25 Nov 2022 11:00:43 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=k4oXxanYjn23hBWHUyNHNnR+s36+1b9XTxzgBw6OcR8=; b=JaXg/URNyDSPDM Y4jECGp50OpH4emMl9R0M9Jp91tBes3LpNqydABrIq2lINCHT+AdWBs1eMXWsneoxBCooGuDSz57Q HreAS2zg7a8VijVj25HKunKl1sYnMTFZsE+AtgzW5yU7jWGj3bZMvI4th236qCCQIkZDUTvq5Q/kK bWu0tw4Yqq/350j4LAkWks2vCi+tkXj61XPyH4z8FxMDMtOq+NMvzsdrc/OKrbuV5FhYKPoWwoxZb 04+PRwqkp0cAnCCFXvhrDJSpLcS5lkEMsp7Z43nP3K3TmPS6QeR/bJoALEtnGpMXCdYn/xoBkaqdd xXL5KTw32bz+46J50qdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyWQB-00FoHj-VA; Fri, 25 Nov 2022 10:59:04 +0000 Received: from mail-db8eur05on2060a.outbound.protection.outlook.com ([2a01:111:f400:7e1a::60a] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyWKg-00FitO-TJ for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 10:53:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B9739MAFypZOWhszxvK7wA0P8jtGzA+gLiuR5890WkOmOXauC0WP+/lZbtmcdyEMKl+d4tklWsug+ahxFdm529xmDEbQVKejmsUF31Pl0HBs8RQKHdFzZ5Iq/R3VAFUk+TbhiSjca+gEjEgMYEDor96NxNhnGowt9JbPgyy/Ziq+0CD0YeAW2C4HH1HHdoHsFRV3a9keIq8JvhWdpPUttKaM5pHpZpF0HK1MtlbAMY104rrxwidpdnb4FTZhZerEt7zeeUz5Iv5PtWboqglkbPu9K2VwTurI+snUj0DxVXopVTIyflIMxi1poFKcntsngZDCGopDbQW0MnKOdayNhA== 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=96UVIKS9iwrJwzzqr8dtCXovSzCH/aKgT0f0uz/BaRs=; b=XgRs+UTs8xaEcDKe416JKJRsDhx7nlCLM4HmaNig2OFLARNUuv4A4aWp8s0TpqVQxa4JG41S6QJGgdfo+i0jxYnWbybXmGm9Uasb7KXGJ1Qq0PFEQSNnKafgcdooXKnQBA7cDl3d4r5YyFDXwggSOFCtoZRx2hQ1rfnbf7q0UkMjGudlmShzYpGxcjNRAulL5S6/wRvqyT2WGtY57xsS1P2kjeWy4IZi2BGLRmfIqgchz/rWQ+YrBoNKY4rxNAK0HgtR/HYvL5eWxPMA8E0jCjz2RLvxISUX5QP+B5/jh5aiHNy4re7yzqHe97RgH6gYwalJAyp4NCVRCDH3DTyecA== 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=96UVIKS9iwrJwzzqr8dtCXovSzCH/aKgT0f0uz/BaRs=; b=C+uCNXZoytLYVn05XLeDl5VlwUGJOJFWapUTrkxxQ73WyXYDbvsAKblUzSL8U9x4B7oJpyDneiu4sOuqIFRUS9KFPD61rdIneriwE+cV2/hId5zWEBHg28mUricaZE7P1ALHmeCe2JJ9DfFaYjjEN2+FZM5HPfbH0/dC+m5JjZI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AM7PR04MB6902.eurprd04.prod.outlook.com (2603:10a6:20b:107::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.19; Fri, 25 Nov 2022 10:53:17 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5834.015; Fri, 25 Nov 2022 10:53:17 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Yang Yang , Xu Panda , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] Revert "net: stmmac: use sysfs_streq() instead of strncmp()" Date: Fri, 25 Nov 2022 12:53:04 +0200 Message-Id: <20221125105304.3012153-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: BEXP281CA0010.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM7PR04MB6902:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e7b418c-bfe9-430d-dce7-08daced341ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H1c/tPiIWBbgApMwVFuqQYpN1cG8Sh47NSv61bL8nMrrSuhul/aIBp2xJdylBVx4mkdrbNIO4z2ILWlD6n98z0bnlZWvwRy9L4F9TNm9acRmP/WCg1CCWaVfxt1JHkZ1NbJRGS0x6U235Xu6V3UEVxKcMj/b6vWRT4pbIMnM9F5PLElPCsRu419tIF2EPOxg8eKGjbbQxO/W5NavKs9nZIzczzG5EaA4tluKhx6dJ3SPf1QZii6qNE001IAQmLVyqLlz2yfW2xfuRfXPo6V+kXWRUPJZZxn/5IhD2W2UmJIRYvBA+aAf1i/FTDcJBH3LUJ7z7MacrnkFg7GiYyDxgZ5l2Ux8PaR/8EJhG5WljiAuJSw9xMfTlRVG1zG1Zm3jU4arHCCl3k7plBngwmMBKRID/aQ0JhT2wwnoyheOoYM5YSTLD80+U55Z98kwGrgRua1ep5ZB5eoW+2JZ2nD0N6BVWG8p9M6/c7IKDQRElJ4ncDPINkvujwdpEaal1muGFgsRRjeJocXqpSglfHNEQe0y7xe9509/mxnY3QfVN+wQ6/tX+WnZbcHRks8Dk6qyVLo2zRIy9jehbTJ8x4EaT+RuuQF8MyO8IGLHVQjovLro0Ra/PJWvd15/K5iwCCEyLmOkDNP+P5zwTsFHxv8WSsf61ZQA6QmeHTVeCTQEkYfxsaVKTsHnTs/0MV7CjTGb3nVchF9Sf6pkaa966i9Fmg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(39860400002)(376002)(136003)(366004)(396003)(451199015)(36756003)(86362001)(66946007)(6486002)(6916009)(316002)(38350700002)(38100700002)(54906003)(6666004)(83380400001)(2616005)(478600001)(66556008)(6506007)(6512007)(52116002)(26005)(2906002)(66476007)(8676002)(4326008)(5660300002)(44832011)(7416002)(1076003)(186003)(41300700001)(8936002)(133343001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?z2HJYLHjD4MxwXTFBL0tM2P7E7A4?= =?utf-8?q?jaZd2Up9sRslh4gGwKHuxF22q1xsjx0rOEz4ITvHqAQDTA9MznFjGYm1F+56jKjiO?= =?utf-8?q?ibFijWMgr92QqTCAQrpMZhq1txboX2TVRXmtdtBf4cLTQLyVcwtChWmxSMepACATF?= =?utf-8?q?bzb+feExHSyQqLziPMP9ylCW/OaAlLV5fmL14gKyuA16BLEmE4nqjBhvy8GHeffDl?= =?utf-8?q?c4V0a9QfnscgXwZWRbAowExaDhdxqsRV581Y78Sf1G5FMnJf6LCzAHoEGq0+BMD1B?= =?utf-8?q?wu9oIEz0qMkgEVJYtYKRQDJdTaUQ/88JsCmey/wg2IwdGcOV2FoDiSioKJ/Uv7l+9?= =?utf-8?q?645L9RYgpZPt4q/Lv29rbxMtdKIKgqevo1z92wd4C0ybQ5CbMuDjSOsBfQAuyJAXB?= =?utf-8?q?gyZok3DLtSMhbYiV1sKhSeuTMjo3PX7NIu6bjDRbKWmZI4xdZbZnZWWj0+NsqDSt8?= =?utf-8?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ftBhhG5Sd9Vr674rDWLKKKaKYn8N3qQadK23MVfwe5PvqiWOx0ycjTyYl1KLNiX/?= =?utf-8?q?pclrziBWzkMNSizb3P3b5qm7I43y3qZJ7SwXYbnrOI+kkJAEcY1Q3jqAHO0Kg0KMl?= =?utf-8?q?P10+v+703gNI+zMzgC8qP4Z005ZimFNxCGEm4pVDBWkBYGAULJMIxE8M0u8vBAsO5?= =?utf-8?q?fTNsXewTvnpTLWcn+tvMesglhiHVlaGb9g=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e7b418c-bfe9-430d-dce7-08daced341ec X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2022 10:53:17.3778 (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: wv+VYZp1VQIC0lkpwmtC6nFaVD7Cqf6Ww6IUJK/u8CT7GbOU3CCShb1Zr4jL1epe6oiQLDqBgATU9fsNhnJ4WA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_025323_277702_1B64F0F6 X-CRM114-Status: GOOD ( 15.26 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This reverts commit f72cd76b05ea1ce9258484e8127932d0ea928f22. This patch is so broken, it hurts. Apparently no one reviewed it and it passed the build testing (because the code was compiled out), but it was obviously never compile-tested, since it produces the following build error, due to an incomplete conversion where an extra argument was left, although the function being called was left: stmmac_main.c: In function ‘stmmac_cmdline_opt’: stmmac_main.c:7586:28: error: too many arguments to function ‘sysfs_streq’ 7586 | } else if (sysfs_streq(opt, "pause:", 6)) { | ^~~~~~~~~~~ In file included from ../include/linux/bitmap.h:11, from ../include/linux/cpumask.h:12, from ../include/linux/smp.h:13, from ../include/linux/lockdep.h:14, from ../include/linux/mutex.h:17, from ../include/linux/notifier.h:14, from ../include/linux/clk.h:14, from ../drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:17: ../include/linux/string.h:185:13: note: declared here 185 | extern bool sysfs_streq(const char *s1, const char *s2); | ^~~~~~~~~~~ What's even worse is that the patch is flat out wrong. The stmmac_cmdline_opt() function does not parse sysfs input, but cmdline input such as "stmmaceth=tc:1,pause:1". The pattern of using strsep() followed by strncmp() for such strings is not unique to stmmac, it can also be found mainly in drivers under drivers/video/fbdev/. With strncmp("tc:", 3), the code matches on the "tc:1" token properly. With sysfs_streq("tc:"), it doesn't. Fixes: f72cd76b05ea ("net: stmmac: use sysfs_streq() instead of strncmp()") Signed-off-by: Vladimir Oltean Acked-by: Maciej Fijalkowski --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1a86e66e4560..3affb7d3a005 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7565,31 +7565,31 @@ static int __init stmmac_cmdline_opt(char *str) if (!str || !*str) return 1; while ((opt = strsep(&str, ",")) != NULL) { - if (sysfs_streq(opt, "debug:")) { + if (!strncmp(opt, "debug:", 6)) { if (kstrtoint(opt + 6, 0, &debug)) goto err; - } else if (sysfs_streq(opt, "phyaddr:")) { + } else if (!strncmp(opt, "phyaddr:", 8)) { if (kstrtoint(opt + 8, 0, &phyaddr)) goto err; - } else if (sysfs_streq(opt, "buf_sz:")) { + } else if (!strncmp(opt, "buf_sz:", 7)) { if (kstrtoint(opt + 7, 0, &buf_sz)) goto err; - } else if (sysfs_streq(opt, "tc:")) { + } else if (!strncmp(opt, "tc:", 3)) { if (kstrtoint(opt + 3, 0, &tc)) goto err; - } else if (sysfs_streq(opt, "watchdog:")) { + } else if (!strncmp(opt, "watchdog:", 9)) { if (kstrtoint(opt + 9, 0, &watchdog)) goto err; - } else if (sysfs_streq(opt, "flow_ctrl:")) { + } else if (!strncmp(opt, "flow_ctrl:", 10)) { if (kstrtoint(opt + 10, 0, &flow_ctrl)) goto err; - } else if (sysfs_streq(opt, "pause:", 6)) { + } else if (!strncmp(opt, "pause:", 6)) { if (kstrtoint(opt + 6, 0, &pause)) goto err; - } else if (sysfs_streq(opt, "eee_timer:")) { + } else if (!strncmp(opt, "eee_timer:", 10)) { if (kstrtoint(opt + 10, 0, &eee_timer)) goto err; - } else if (sysfs_streq(opt, "chain_mode:")) { + } else if (!strncmp(opt, "chain_mode:", 11)) { if (kstrtoint(opt + 11, 0, &chain_mode)) goto err; }