Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2031734rdg; Sun, 15 Oct 2023 08:06:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmimfBrRVB1ijEHu5Xi2trEHyM+Mbdry/l02uIh0KHZrcbDh7VE0/uGvWCvrzik7MzUdKB X-Received: by 2002:a05:6358:785:b0:143:81bd:c0ec with SMTP id n5-20020a056358078500b0014381bdc0ecmr36042663rwj.6.1697382392355; Sun, 15 Oct 2023 08:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697382392; cv=none; d=google.com; s=arc-20160816; b=CtQPgf6qocgGT0kSdSMA8LOnh6vBwu/gRIC87Qq8By0hinrQpcL2raJ5OoRBLFdEGY JXMao+FjVUQkCgBcDi42brwUCoTV67XLZC/P3uhbAfN3bU61ZXJ6JbWxpC4jCHRaInFW o9u/oH015of814o/i1pYZi+3Uc6BflHKqXzoUQ2oUj1Oa3VUx2+TmpH0iJin66vMkVn9 Ca+6zrYTq8ZVU/eLWR6bOvbh/9f7WZp5frCAfShJ4AtRyK+GjdsdP8/7OM4YGlDNidRP 94QUzVkfxfzPyA9DVUu7O9x9uN7trVlrsIcIvsWSLZsmqX64qkss+Wlpbsx5IUNj0Crs ZgGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rke/TzsOEc5oR/lmCNLPZ255stvQ09Mg9RrpSvBLsRM=; fh=IoFRKyVlUXDl9l2V+xHVBV/3U3Y1ckVX4s1qog+Dw0g=; b=kq8TgdBwNReIFgOlmZYsJid4Z28PQoFpTQgf7rjUm5g1cTMUGPMuZLU5FLXOymjyeK pEXN1fsGTiDzN6L847n1uk4n1A/xKZ43B3zXQQtvIptxics/xW3PqBKmkKmGrkjVvK1f U8vTJvF49lqGp+1XWgn5x+Q4iLeDbaitILzQdOL2xsRD4ihdhRz0eTTgla4Ey84g2tgW PKdqw7Yqpzqu8z4kfhFGd45S/pVf4GIDJdVejeatFDV2qLrT4pEkeaoMNykfmOKNIxap Pjp5uyisSXYrPlmpZlUJwTqh2LXivgV+PS+L8pu5Kf+KW4LhneWieUprja6ApkLvlMSL Wj4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r13FFCdM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fb25-20020a056a002d9900b006be1dd29127si426102pfb.127.2023.10.15.08.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 08:06:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r13FFCdM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 84A8C80A5FB3; Sun, 15 Oct 2023 08:06:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbjJOPAK (ORCPT + 99 others); Sun, 15 Oct 2023 11:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjJOPAJ (ORCPT ); Sun, 15 Oct 2023 11:00:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96DC0C1 for ; Sun, 15 Oct 2023 08:00:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0577DC433C7; Sun, 15 Oct 2023 15:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697382008; bh=i1GxOtLnEEkuG6UtAHUPo6Syh/xF5t9Xh8yNbZzp1nc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r13FFCdMoDsRZoAP3FchBMyje6QT4GpAgEDxnCM10TRk47MWPE0/XRFLgAAfv6FBB CHBE1odsSJTtZ0QTDv0I2e7ycYgZ9Bqd973o5gXuRAdK9hlweTGTcVfAJO5IGP/v6G 5jU4mfqa5PWV6BGHMvlv/3bXwuV7l4KoFAIFy7WvZs8aknz/FK2yfb0ZSuZNl9VmJT V8REeXj0mn0iybqhEYtCrQHkeVSyr5D4ysNdoRdgVJonfmaAjfGxr12sw8DF9/XqkN YblNPv541aLT2Qg2VM0DExr++cI089lzsC6u+GMn7YrICTyV4u3eDWEvnWUn5i5e0m u1e0iJxIVuFSg== Date: Sun, 15 Oct 2023 17:00:03 +0200 From: Simon Horman To: Justin Stitt Cc: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net: phy: smsc: replace deprecated strncpy with ethtool_sprintf Message-ID: <20231015150003.GB1386676@kernel.org> References: <20231012-strncpy-drivers-net-phy-smsc-c-v1-1-00528f7524b3@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231012-strncpy-drivers-net-phy-smsc-c-v1-1-00528f7524b3@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 15 Oct 2023 08:06:31 -0700 (PDT) On Thu, Oct 12, 2023 at 10:27:52PM +0000, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let's replace strncpy in favor of this dedicated helper function. > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt > --- > Note: build-tested only. > > Found with: $ rg "strncpy\(" I agree that this is functionally equivalent. Reviewed-by: Simon Horman