Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1659827lqe; Mon, 8 Apr 2024 16:30:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLtcLKaO4KuZv5AVXp+MRR1zA73uYp47osaBOkoUmiOikEMe4bkor8FokM6WXbAnV9YqlwBDbStdYOQVnjcFrge00q0rWvxtkDhHGUiQ== X-Google-Smtp-Source: AGHT+IEvTHtOF8W8khleQ3M5iUgTtFi3KwOtkihYDGNd11fuI71Q1a0p2Vw0ZHuJfaK/4sA8sCp3 X-Received: by 2002:a05:6870:a44a:b0:22e:13d4:9f14 with SMTP id n10-20020a056870a44a00b0022e13d49f14mr11469115oal.3.1712619051891; Mon, 08 Apr 2024 16:30:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712619051; cv=pass; d=google.com; s=arc-20160816; b=CqLsUheTPUCYMW2aNOTSk51Pdn+cpeNFEG5/rR3LUyP4LdJSAmmdSUU7vI8iJ4i34K VeF5TTMOyCRgKGeDIbyY1YpWRdaCyj7ghFDsBGTfhe05OV7pCDIDFXuxW57IHOrBUMbp mPN2o+n75XAqGqC9n70aVVVFLtIX6dSIWIxIluUJD3zprHU9eTm2NRCB6AzAMduUravh aqD6HFxS8+IWZyBizkNr/WYNlKcRsLRIYIFYh3tkemhFxNfwHVwVCAyFpuXpaSEhrPsQ C3hAsq8NgqoXRphh3LprRNqffqfWulg7dl6errRBwNmfT+6t1YSXl39lmgEFMGZ4tA7o GGmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=k+SiT5TlstlnW48g/wuVm80XsJWvG2bQ8P1YkCxCZTo=; fh=exmEqCTeuKx94t8uT/APMs8W4mAT0WfETQxuKwdGnrU=; b=mhjCNuHxenEHPAA/dNkoUdtOm2lf/AWv/X+BqwcNfA1KAGNj/yUljxAndjCI/54DIi 1PoMi0cGCZR38JZ0cX0r0WA8VhZcl2vmbDCnNV1kUCc9l31FFOCWpBdIVq8Nq4GRr4s9 SqHbcl7eY679EClZLB6MxuPaZM7AfrCCGvloXCbhLZoFIjCbSZC3PXN1I2gILp9/cmsP UaM9gJc3Wak4+21v9YGu0ci3StOZPd8RGURIljP/NFlLWxrWKwN9XuYltcm7kh/M7mtO KRGl8jrLhT1Ra8jvFAU9HWg+IowHVvJwwzqViXCDYCkInD3M9Jt/+G3ENTPRIjsCdqI3 oz6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A7tfDht1; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-136014-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g4-20020a635644000000b005d8e283c1ebsi7088381pgm.840.2024.04.08.16.30.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 16:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136014-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A7tfDht1; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-136014-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8006928683F for ; Mon, 8 Apr 2024 23:21:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFF99149E1A; Mon, 8 Apr 2024 23:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="A7tfDht1" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A52D143C65 for ; Mon, 8 Apr 2024 23:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712618456; cv=none; b=FSq4a0CEGb7o75RKbN0nYdzzWcoGhGhjsaOouFsrtmcEIlWLt5MOomg/kOigAlAD2ys2dlpNCQSnUrLw1LIo/95VuiG00/LAXx6oGRz6EY/p+nDTqHsRkZsBziWg+qP1NIKyoo3mHLBzQUe+b9WxBgxs5y/t9Kq5Dhi4BEMn1jI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712618456; c=relaxed/simple; bh=ABYWepUPTpNOjIti27XRT5vSfcJbPAQWDlfjw/lOhZ8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dwYirbsfqj3XBGeGwhuMfskkaIC/13gJzT+ZI1qBX4aYCBpros/J6Ayk8+Tg/5R6XyPXb5JEq26OAVmNwd5/ZfPBTK63HWqeft8rvbl74SbNMgyaPjk0qv5j009RIihSl9dJvtLUj+WGq5SiaxgFv8OPSW3tXy9tSC3+qB1Snd0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=A7tfDht1; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5d42e7ab8a9so3113924a12.3 for ; Mon, 08 Apr 2024 16:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712618454; x=1713223254; 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=k+SiT5TlstlnW48g/wuVm80XsJWvG2bQ8P1YkCxCZTo=; b=A7tfDht1QiAasrAarWgQBcp8WjrM0U9g0mZZ4NCgvzol+70SMfDqbCwOKj9bkiy3aN 3zM/9kN7bm71kuIetoUPLapxRZOM9Rb0mmWODp0EpDPVy/MbcHOrIrKVRMRe48AKCxmJ GqhxoZFqH0naH8qdkMPcGDY6ABkAGir+Zwq1w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712618454; x=1713223254; 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=k+SiT5TlstlnW48g/wuVm80XsJWvG2bQ8P1YkCxCZTo=; b=dmI+xmv2zttdoqzid0D2L8JzBNShGqjFpUjKNdKePhug2erCsM6iqblxyQHJBTUemB 2USQuYZVXkdHSRWTYiuOuZ/XnCSauD8MjRV5ukbGdhl+ttCzZy237ExP9aU7KSScXZQd r48SXBggdjcSR2lGkK+JNIVu8pwzdxawSkUOTpUusvu+MiqOZVhjCqLGdrPNvG46a1GR vd7OJXsrfX+6bU4Df2K4B/DWUTVACju9nBaXGjlnmGCSbpc4+TN4pyXnDOBhNAAbdlGf GwGvKEfZc/C9fgo6WsTjtMM0a7KR+m6+JZ0n0QwUYrUeWR8eaKZBMHH7/iJVMsPipMTg 2dgA== X-Forwarded-Encrypted: i=1; AJvYcCWyHpvO/1Wb7PcKLDv4B4KTMQv1osGu/2FOfEjIxLzweaAtV4QbiNqlV+Ned7v1M+1tZ1/sPDCbj4IDGvfp0mhBJlRrb+PwEo+p8pLD X-Gm-Message-State: AOJu0YxF6b22cNWNap8sqSAIO7lahVzVwll4rIV0tB8HdvdxSCNJW+XW yjtC0sXsGNzAjCVwCz5eRFELm80kmmTX7FEo8t85uE28mKzN71IPsM5PAuX3sw== X-Received: by 2002:a05:6300:8085:b0:1a7:3365:d8ed with SMTP id ap5-20020a056300808500b001a73365d8edmr9271766pzc.29.1712618453799; Mon, 08 Apr 2024 16:20:53 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id 12-20020a170902e9cc00b001defa97c6basm7517122plk.235.2024.04.08.16.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 16:20:53 -0700 (PDT) Date: Mon, 8 Apr 2024 16:20:52 -0700 From: Kees Cook To: Justin Stitt Cc: 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, Alexander Lobakin Subject: Re: [PATCH v3] net: dsa: lan9303: use ethtool_puts() for lan9303_get_strings() Message-ID: <202404081620.D050527@keescook> References: <20240408-strncpy-drivers-net-dsa-lan9303-core-c-v3-1-0c313694d25b@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240408-strncpy-drivers-net-dsa-lan9303-core-c-v3-1-0c313694d25b@google.com> On Mon, Apr 08, 2024 at 09:01:57PM +0000, Justin Stitt wrote: > This pattern of strncpy with some pointer arithmetic setting fixed-sized > intervals with string literal data is a bit weird so let's use > ethtool_puts() as this has more obvious behavior and is less-error > prone. > > Nicely, we also get to drop a usage of the now deprecated strncpy() [1]. > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Cc: Kees Cook > Signed-off-by: Justin Stitt Reviewed-by: Kees Cook -- Kees Cook