Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp77034rdh; Wed, 25 Oct 2023 16:59:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHZCIrgQMU6n7jcis3uhuz6UCWPtlpQ35HD7IidB2xrwOUVsE5BS/7aS9abY2pJeN6opu7 X-Received: by 2002:a25:7806:0:b0:d9d:12b7:52fe with SMTP id t6-20020a257806000000b00d9d12b752femr10986817ybc.48.1698278379373; Wed, 25 Oct 2023 16:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698278379; cv=none; d=google.com; s=arc-20160816; b=tPXFqIFu6B5EMINAVzLWxTnCsJyIqdF6aYwIgJaWOGnkoKBGiJx6EULqMAPeAQ0261 oQ0VuuNGuewGEXFod325JbAw2nNZpb8/xYgPBsk48Uu2I7JIVBD6Q9vZjp1uG54hFSkA +n/H03IMR1zi8QQNwi4eqyyOU7BWIZkqu5N0X47oKkQEy+G5MVzBeiz9PX05BgkqqI8s uwPLBHDnv+irEn9YIyM3HENaPPas9w7falr7Jwct2EBJilFIALsuPuDsSz8rQyIwcopQ D92oCnc/UKkPzhrTObhCpGpjuCkmRNtshAIAXPejim0xv4H4fuCVhhJDRwyaFOY46iRo Ey1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=rOKIo8DF+sUuPmcncHrP3egXRJzB8ddS10YhGbuNSzU=; fh=WuvQF3bSbQq8NNGP8gwa6uM7Mp3Tx/R5h08trFCEVis=; b=cfWngK8hSqBUp4cARexcFtwt5G9oRnha5cTUow33XmYgjNIDt5+hNlX4DJgQs6WZDV xGHw5hFbL3T5MGppq4Zx15EPtW8pLaLWLKKtL350CKplPdnLKVDD+PE2wk1jTcmtq/3N kDqn+wSEQ1aNbjUaLq4g/rzzQy9N0pk7f3G/Ku15TrkhjO9QKJkdWBZ/j9icrhCVyLpM QpupfRVMpEFgxQdHQ5z+7Q+ao/0s3n9IE2n+lr6SvznkOqb9pkOHp0wG9YgTAqRb8wwg 7Gad6cyljJW0YNgPZpeeRZbDMkzLMzwqr4bPDFp5nCDdIuFRyWksMAFR+qKESyKCiLAb Aakg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UB72BJq3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l18-20020a252512000000b00da03c21d5ffsi5939458ybl.335.2023.10.25.16.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 16:59:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UB72BJq3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 93B9E80F7E57; Wed, 25 Oct 2023 16:59:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjJYX72 (ORCPT + 99 others); Wed, 25 Oct 2023 19:59:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjJYX70 (ORCPT ); Wed, 25 Oct 2023 19:59:26 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1328C10E for ; Wed, 25 Oct 2023 16:59:24 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-507b18cf2e1so349875e87.3 for ; Wed, 25 Oct 2023 16:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698278362; x=1698883162; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rOKIo8DF+sUuPmcncHrP3egXRJzB8ddS10YhGbuNSzU=; b=UB72BJq30rGKXf7E1VClFhiDBSQdC/A/I7YETf/8ML6csp5zKnN7t00iKD5vtOmoXU dcdHQXCL1O3qlHdvVcDcHpLvyV29VLutrqr1UTLVWAA9WXbMp8z95kgaEKYaj44WabNe fGgmvEuZ+I1iGodb+i2IJx7AG1Q/3yp6qZzFBvv+wVMP8Aixjl9RwX6JBbKOgbWhQDqe dS6CU9hWQa/k/psvIL8aKmFLLx7C4Cs/Jwk4Z18JPNNcgWpa952z61f9/nCxCJjrwArH DLrZW6c+EH84f3p9ajt+VXktdRLAE5+Bt0hrKWM7tUzO0nvLnfzLxwq/AQF0qyjFpzME a/Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698278362; x=1698883162; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rOKIo8DF+sUuPmcncHrP3egXRJzB8ddS10YhGbuNSzU=; b=tycsxrh8NG4Fd2m9TV4PID8Mzfl6Upp1K9kz/R0rarjgVS1rkbFv4lussdT+oXmVRn jVlBnhx8nMP7hCfc5TwTGv4WEAbGyoHVjF0+3DDRrn8EeTUgue+HQ/5nt85X3Lh7lEgF VZe1xRBSxYDy902ntOmdgcoUE/s2Q8cYqESCezLeSrWuUZDRrCMo1YQDlC1MDKGt2qVS okIxluEZ7Uuc5c8PyvYDDytW7X6wj83qxBpdnGW4e+CQnMOa8Poz9g0CBjpJlVmPAapP goOg8PBBfSZFX8+wntV/VKO5YwMNSF8mUsLRn1eKIh00hBU6aV57QkwqPJXEAk39Ymcy /wvQ== X-Gm-Message-State: AOJu0YyY+cQ3m5bItBSwMQIvf8mt6F9Y8XPOH+yd4yBUKV5T4BupqU2x 14pE82QrdrqMgyIN1RU2HqspZacB7vURP3lo8TeZvg== X-Received: by 2002:a19:2d54:0:b0:507:ceba:a94d with SMTP id t20-20020a192d54000000b00507cebaa94dmr12847400lft.14.1698278362169; Wed, 25 Oct 2023 16:59:22 -0700 (PDT) MIME-Version: 1.0 References: <20231025-ethtool_puts_impl-v1-0-6a53a93d3b72@google.com> <20231025-ethtool_puts_impl-v1-2-6a53a93d3b72@google.com> <10a072f549e187bc2fdc735c0161c09c90fc1392.camel@perches.com> In-Reply-To: <10a072f549e187bc2fdc735c0161c09c90fc1392.camel@perches.com> From: Justin Stitt Date: Wed, 25 Oct 2023 16:59:10 -0700 Message-ID: Subject: Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts() To: Joe Perches Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shay Agroskin , Arthur Kiyanovski , David Arinzon , Noam Dagan , Saeed Bishara , Rasesh Mody , Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, Dimitris Michailidis , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Louis Peens , Shannon Nelson , Brett Creeley , drivers@pensando.io, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Ronak Doshi , VMware PV-Drivers Reviewers , Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Kees Cook , intel-wired-lan@lists.osuosl.org, oss-drivers@corigine.com, linux-hyperv@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 16:59:36 -0700 (PDT) On Wed, Oct 25, 2023 at 4:51=E2=80=AFPM Joe Perches wrote= : > > On Wed, 2023-10-25 at 23:40 +0000, Justin Stitt wrote: > > This patch converts some basic cases of ethtool_sprintf() to > > ethtool_puts(). > > > > The conversions are used in cases where ethtool_sprintf() was being use= d > > with just two arguments: > > > ethtool_sprintf(&data, buffer[i].name); > > OK. > > > or when it's used with format string: "%s" > > > ethtool_sprintf(&data, "%s", buffer[i].name); > > > which both now become: > > > ethtool_puts(&data, buffer[i].name); > > Why do you want this conversion? > Is it not possible for .name to contain a formatting field? The case of using just two arguments to a ethtool_sprintf call may cause -Wformat-security warnings. If it did indeed have format specifiers then we would have more format specifiers than arguments. Not ideal. The second case of having a standalone "%s" isn't necessarily bad or wrong. I used this exact approach to replace some strncpy() usage in net drivers [1]. I'm working off guidance from Andrew Lunn [2] and Kees who said it may be a good idea to tidy this up with a puts(). All in all, this patch doesn't do much but fix some warnings and provide a more obvious interface. The number of actual replacements are relatively low (around 20ish) so I was hoping to sneak them in via this series. > [1]: https://lore.kernel.org/all/?q=3Ddfb%3Aethtool_sprintf+AND+f%3Ajustins= titt [2]: https://lore.kernel.org/all/a958d35e-98b6-4a95-b505-776482d1150c@lunn.= ch/ Thanks Justin