Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2072416rdb; Mon, 9 Oct 2023 11:30:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFL5aw0qDWa2vauPDrsxgOX+N0/EXvL+8A6BxWeV8JZtb05Vj+u4ujmN7Y3UROlhk2uZyjz X-Received: by 2002:a9d:6f14:0:b0:6c6:50fb:cd0b with SMTP id n20-20020a9d6f14000000b006c650fbcd0bmr16539274otq.6.1696876254112; Mon, 09 Oct 2023 11:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696876254; cv=none; d=google.com; s=arc-20160816; b=Vt2aNN6D1qGP3FeszMlvT/mv0F02+loprfKa3wC4bBC3/3JMDBclpZ1csNXvZ6nZw7 WguGyV7hDVdDaxHIUgvrMbq1CBiM5STh0sBO1IQOYAJXEc75WGtFjNOBBSVrrxF2js37 z1I1DzFCWEV23YQavoG7am6fJkI8GGrGj7hfxPHSq1c8+i/bVItPJjjaET/+V7rFOI7C BSvXykgt3WOq00DFCxHGrRiiAOdtuzqcaxACArB2ZJuACSY0MUTEkvpytO3nTx5AO+3B sOa0jc4Mjt+ffAP2ypZIeADd2aDrS/4yHGiJNNaPY4cBde7mx0sP8JEOFlZ85YMuZJZ5 ryvg== 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=gxVMY1OUOOlkYUMoJXmeHdAeSba37eU+fIFYQmsdX9E=; fh=FsCqQPf0UdRo3SFKLGZflMv7iiUs0vvPVOExuhGSP00=; b=BztHhc8npyCcrMAp8VMiD4nopees/9QmloMiapbOFlYS/my5wjoJwjUIJr9nYzS+GD SJ8CEMXjE7dobg/kkltINCwkPyrHv6gQw0UFqjLh7limqvsBdtihPgHd4hQfXP0X2za8 NcbxBEIIMfoE8dmao8WiLWETBsB1mBdDV5ac2YNDHFqcmcoF0k3JzFele++T+GfqZt9x WM44g7VVZHbpXAhgZVaB3GZ1sRBtV+4dHVef29XBtGwMkiV/xBkK9YwmdSHTd4XVNgk+ npeXTMjcHNJgERcAu1jWNktGkc23TJ53zAVKmqyIMaL5tBz/jPxkRp1mdPiBDiIhPuNz UTrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PVjdavfK; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id f20-20020a63f114000000b00573fc71f6d9si10488886pgi.64.2023.10.09.11.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:30:54 -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=@chromium.org header.s=google header.b=PVjdavfK; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6FBC680BA685; Mon, 9 Oct 2023 11:30:48 -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 S1377507AbjJISaX (ORCPT + 99 others); Mon, 9 Oct 2023 14:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377537AbjJISaV (ORCPT ); Mon, 9 Oct 2023 14:30:21 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4508DB4 for ; Mon, 9 Oct 2023 11:30:19 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-690bf8fdd1aso3490282b3a.2 for ; Mon, 09 Oct 2023 11:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696876219; x=1697481019; darn=vger.kernel.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=gxVMY1OUOOlkYUMoJXmeHdAeSba37eU+fIFYQmsdX9E=; b=PVjdavfK4H0SFaPAZHoiF2Mz9Fio+eBcEV9zgzDIGqONg/rK+sWgPIMK8fduwzeykl wpKzysSGmpbZ8oGEw7nf0oM9404nZdKvolP7q95hwErWoHO7KBYzC4roGqLSUmSY35NM Ii4QdH4AZpUju1uGh3di+7CbEABCkj8accljU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696876219; x=1697481019; 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=gxVMY1OUOOlkYUMoJXmeHdAeSba37eU+fIFYQmsdX9E=; b=tfDoSYIMc5f3Y8ze/25jje6FC7pBN8oRw/xZ+rOJa3REmtvTHKRBaf3Kybvuo7XK1Q lL6Zm5xxDhJ2remqUTH3fQSbENtURZojVhu3sY23rTfoP3kcoOK24Pc2CPDyhk5IHPZP 8hFuOFgAK6Ol+9NHO7YJe5qJyIrE6EkrTC7iaWqpgVycgEP5obC/ldlmygPr1tjQYcRq GaYAAZVl4Dv80KAGKmICE9VQh9ZGM8fR+OnRbeCuQBz/2Obt4CfohKOhucJCBQL1v20n nQr7tWR6a5FUJsQYdPArUZ+2guPGvAAbfJKhqHStLiT5xVDhshVbE5Dj6TmWDaP+Nmbg W7GQ== X-Gm-Message-State: AOJu0YwT1OJunv1CNsbTePWrNB7pxZCr7rZ90kwywOhN1dJcxvQjIKI0 N1bTpSkGKfi7Swm8RLtdEU+t7A== X-Received: by 2002:a05:6a00:39a8:b0:693:42d2:cde0 with SMTP id fi40-20020a056a0039a800b0069342d2cde0mr15018986pfb.22.1696876218716; Mon, 09 Oct 2023 11:30:18 -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 e19-20020aa78c53000000b00666e649ca46sm6734193pfd.101.2023.10.09.11.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:30:18 -0700 (PDT) Date: Mon, 9 Oct 2023 11:30:13 -0700 From: Kees Cook To: Justin Stitt Cc: Hauke Mehrtens , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "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: dsa: lantiq_gswip: replace deprecated strncpy with ethtool_sprintf Message-ID: <202310091130.BC94148F@keescook> References: <20231009-strncpy-drivers-net-dsa-lantiq_gswip-c-v1-1-d55a986a14cc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009-strncpy-drivers-net-dsa-lantiq_gswip-c-v1-1-d55a986a14cc@google.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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]); Mon, 09 Oct 2023 11:30:48 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 06:24:20PM +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 Looks like the expected replacement. Thanks! Reviewed-by: Kees Cook -- Kees Cook