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: 25926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3923691wrr; Fri, 25 Nov 2022 02:59:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf67jNERP/F1GKhbghmvYANkg828EAWwZlL9Rs8mkM9PfeDysfzPI0SvUWZdEu88K+g1KPTc X-Received: by 2002:a05:6a00:4205:b0:56b:a7cd:f47a with SMTP id cd5-20020a056a00420500b0056ba7cdf47amr38933032pfb.22.1669373987814; Fri, 25 Nov 2022 02:59:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669373987; cv=pass; d=google.com; s=arc-20160816; b=UOKGfDKVOFP/wikhaPN6Kw9I8IA6CTz73taz+p097YwVlFHBWAoOhbVY7M7eMo1B3p j2znO67ws4gbWMR1DaKVd8mWNdByWDn/FN2GFkRjqcs1j9V3CVXHtF/60A+CLIgCNKx8 TzY5/pxILR//F9l2E5GB0Ln376HFnp1JtnepPaObrZAS7hihPqj97tKq7DKVwNhBa0zv Jk5pqwD6QIc7fMN3qQR6qfBWGRQIuKuSCiV0sX8MTqaoP2W85xR7MGlEPKXu/PtMJGEU MTNA8zzhPFodbJeenPlBOAPW9kTvhIzQvTyWs9fLqEGMvcQashPRp0VHabWlFlieqHLL qhUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=96UVIKS9iwrJwzzqr8dtCXovSzCH/aKgT0f0uz/BaRs=; b=SvUA1hMyIsVR2pisBXsVQaA0QZnjULBaPD2F3mPaGcqliHYLYN1EXia8ml54UzTod8 oaCiBlPYyZKD0QeJ42XDI85lKOkoVe2o5ZF/1s3IgecDhFjDczkrTo7Fo7VipbigvNxc 74JjcHBSs9TmoQLutGQ09VoiIVtAUoAYaaw0mdcz0+GBUIh6V6py8dqPXrl5D3pyXp0y vvh5HFyka2yKHMXcn6hCC3momAQWaAUAIOU486BxsmDQ/Pg5HiEuoG0vgRVgsAP+lrUl NOg/r87oejAfY2JApLsxjSD2X8QcCXi2IwdUw6m+Eadum/FWX+KemHRF7vp41ExR/6ZD Ff/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=C+uCNXZo; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170902d34c00b00188ffe7f69fsi3420292plk.251.2022.11.25.02.59.35; Fri, 25 Nov 2022 02:59:47 -0800 (PST) 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=C+uCNXZo; 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 S230247AbiKYKxX (ORCPT + 99 others); Fri, 25 Nov 2022 05:53:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiKYKxV (ORCPT ); Fri, 25 Nov 2022 05:53:21 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2060.outbound.protection.outlook.com [40.107.105.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D986423BDF; Fri, 25 Nov 2022 02:53:19 -0800 (PST) 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?q?8aj/h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sd9Vr674rDWLKKKaKYn8N3qQadK23MVfwe5PvqiWOx0ycjTyYl1KLNiX/?= =?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-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750465498474523434?= X-GMAIL-MSGID: =?utf-8?q?1750465498474523434?= 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; }