From mboxrd@z Thu Jan 1 00:00:00 1970 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 D48A3CDB47E for ; Wed, 11 Oct 2023 21:47: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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gNQ+t7v5t+VNS8/VxEmRBpWqZd6/6WHLqVGOkL+gYR8=; b=ofH/9IEhVEct9U q/gkMkQa20JzU/iwnBzbu3dyRf1ac+StjBM+XEp4oItmLfIjxTwG4rwCH7x+Vq6WRSsyDIyQ/g0yv YWK4D67A94z5+4eMNqtRLN8ksj0Fftl28QPf8wKGSz2t0gm752HfOO8YW6XXBR/+0jGlo5SWrDafm ko78kudt0FlHoEXsrgI+w7q/3yR58bcjA0gGS2+zoFLt4hh8VEnxjMttmcIRsbZFsSZuoUnBuL/Um 7GAUfJjcP9SVA41sBN8w1wVzhNWvpB3irtxRo6PtD9+6jF+FpBGyzjx+v058UxTuRhNFajj7pck98 VnXmojWmmhxJo3Bg9jYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqh2x-00GlJv-1J; Wed, 11 Oct 2023 21:47:15 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqh2u-00GlJA-26 for linux-arm-kernel@lists.infradead.org; Wed, 11 Oct 2023 21:47:14 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-694ed84c981so227217b3a.3 for ; Wed, 11 Oct 2023 14:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697060828; x=1697665628; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DliNubgZ3L6vef2Ra8wVSW9yzozyF2cKvi4YuY9eg88=; b=gNot/40hhLV21SAdZfFW1hAR+H7zjVi2BCCcTaJyDYHzqvRkBIue3QQENHxABY77U4 6YoVWJm/u4NoRmzN866KVelLkqoTXHhyckRtDc4T3JHEWxMcIq3dw91cKGDQUMLT+roS jcyj0iUoPXwXe/T2fi+/OBnjEjL436pDzrfMU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697060828; x=1697665628; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DliNubgZ3L6vef2Ra8wVSW9yzozyF2cKvi4YuY9eg88=; b=QJdWOTWiAnb8LpxMNL2SvIBkHFg+IkNbp5/JjsulYaT5XoxeTy/9jlCNfKZ5HJZGt6 FiHUYIsuERqs/riMe6T3ZUmL+kzmk2rXKY/AhLTO4qKyIprTeXt0HoM0i3snst1FDI51 P+l4xn30OMRlrn94aUnAsaQMwo1JEDb7JZB/5nIfn2wgsaZFipI5e1U98tmyqd8OcoIp i3HZi6uFR8sdDs7mUgpAbTuvCrPEc5qa3d4BcWjSj2H14/L/LPiKKa6vpBdR5sNQbaWb S74T9JtnMPpxGfR4LIAooCdrHV7nNhK9W/oGZVjfHwOHGDqeC/O+GIpjKnkWSnRXuIfS J16Q== X-Gm-Message-State: AOJu0YzSIQJUVuu3UAPP4YdoMINCT1j6ZJxXikKzbkk5TeMrkBpW/Zmr cMLOtruRPEqBRo1b+0D/czSxpA== X-Google-Smtp-Source: AGHT+IHn9FZCyGPq5iD4/DgWZqDBY4ynB/GmoMDjUPQpBVksxYpnz/RnAENMHsW9BUYlz+YbTvy5ZQ== X-Received: by 2002:a05:6a00:17a1:b0:690:c1a6:1c3b with SMTP id s33-20020a056a0017a100b00690c1a61c3bmr22705274pfg.33.1697060828007; Wed, 11 Oct 2023 14:47:08 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id a6-20020aa78646000000b0067b643b814csm10527541pfo.6.2023.10.11.14.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 14:47:07 -0700 (PDT) Date: Wed, 11 Oct 2023 14:47:06 -0700 From: Kees Cook To: Justin Stitt Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , Daniel Machon , UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net: sparx5: replace deprecated strncpy with ethtool_sprintf Message-ID: <202310111446.66E1E8A@keescook> References: <20231011-strncpy-drivers-net-ethernet-microchip-sparx5-sparx5_ethtool-c-v1-1-410953d07f42@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231011-strncpy-drivers-net-ethernet-microchip-sparx5-sparx5_ethtool-c-v1-1-410953d07f42@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231011_144712_748972_D73523FC X-CRM114-Status: GOOD ( 10.21 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 11, 2023 at 09:37:18PM +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 more robust and easier to > understand interface. > > 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 Another direct ethtool_sprintf() replacement. Thanks! Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel