Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp337353rdb; Thu, 5 Oct 2023 07:26:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4fS/Aho3N/Rt+YNypGIhHwJ30NCv4f8h1Mr6tOVIWAGcIA2QfVjCNB2uALYXdMZIBArtY X-Received: by 2002:a17:902:d4c5:b0:1c5:6f4d:d6dd with SMTP id o5-20020a170902d4c500b001c56f4dd6ddmr2395178plg.24.1696515977694; Thu, 05 Oct 2023 07:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696515977; cv=none; d=google.com; s=arc-20160816; b=VVIM4uBMkjk6RKmpKw2Zva8siKrtiI5xojDvdIii/yZtwYI4MlmEq0LFwK6mLZijrO PCNIQozo7oajuqKIKOtXQI7bQTY3s3pnNqsgIiixas+GWm2bzYM7X+98wI5NAMTnySDy n/koeRSclkxqCJPBfE787J1JTM4+eSx9y/Fo/p2XhDNtucopCG0w2EJNUguAVBq4JcDV d7tfpE8tP+V7/D39VfMIhF62NtAIXDUHFaSrVWz9M3ZBC1FrQYjMeCzItCe9CC6lqgam F9jpZeA7Us13j8nl9VIJ2hjLd/ApUlnGoZXtWJyv5aJRZ340WYIsM9P59dLEw66Ghl3T pY2Q== 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; bh=CReO9Bk6AevFYiNxzKjaWTCT8sKbm/WyXqlWA2+do0Q=; fh=UZPSKYVjrSANZHlFuoBDjIUq646DlpkjmTUEJ5/+h2Y=; b=d1+TmOylHynujBklqnlo9VhJF26D33wG0bLaa8Y6yr48aU1XOq7y+qzGW8oRMmG3lF bt0A1AUCGy2t/IhMrtanutIU2dGf13afiBSyCp1+9i4q34a8WPQPFAEmJDiDhYQFgkTo 07ci/sPYJQgGmBx/vvHJl1FoGkFqZyXG8al3bSZGYL8SnfFAR+yT1/65nOfMrF4t2V2d OhiA+UXmMQnM6KGhc9LuOwPse8clFRZH5voKXrc907a0kFpAc2tku6hVo43cN0Hf4EsS bKK5yZF6h3WWq6lITpqDSZ8EY8qVxOC3ezyC+IB/Aew0JvmqBzYZnbibQYTLDO17xMC9 uJ8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id by21-20020a056a02059500b00578086d1387si1778918pgb.74.2023.10.05.07.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A80DB807E465; Thu, 5 Oct 2023 07:25:04 -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 S232589AbjJEOXs (ORCPT + 99 others); Thu, 5 Oct 2023 10:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbjJEOWM (ORCPT ); Thu, 5 Oct 2023 10:22:12 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C97869A for ; Thu, 5 Oct 2023 01:11:00 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qoJRY-0007TQ-8T; Thu, 05 Oct 2023 10:10:48 +0200 Received: from [2a0a:edc0:0:b01:1d::7b] (helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qoJRW-00BDt4-Vq; Thu, 05 Oct 2023 10:10:47 +0200 Received: from pengutronix.de (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 96E5722F885; Thu, 5 Oct 2023 08:10:46 +0000 (UTC) Date: Thu, 5 Oct 2023 10:10:46 +0200 From: Marc Kleine-Budde To: Justin Stitt Cc: Wolfgang Grandegger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] can: peak_pci: replace deprecated strncpy with strscpy Message-ID: <20231005-protract-trough-04a747b5dae2-mkl@pengutronix.de> References: <20231005-strncpy-drivers-net-can-sja1000-peak_pci-c-v1-1-c36e1702cd56@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yfy7e5plv3snihai" Content-Disposition: inline In-Reply-To: <20231005-strncpy-drivers-net-can-sja1000-peak_pci-c-v1-1-c36e1702cd56@google.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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]); Thu, 05 Oct 2023 07:25:04 -0700 (PDT) --yfy7e5plv3snihai Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 05.10.2023 00:05:35, 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. >=20 > NUL-padding is not required since card is already zero-initialized: > | card =3D kzalloc(sizeof(*card), GFP_KERNEL); >=20 > A suitable replacement is `strscpy` [2] due to the fact that it > guarantees NUL-termination on the destination buffer without > unnecessarily NUL-padding. >=20 > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strn= cpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.h= tml [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt applied to linux-can-next/testing. regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung N=C3=BCrnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 | --yfy7e5plv3snihai Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEDs2BvajyNKlf9TJQvlAcSiqKBOgFAmUeb4MACgkQvlAcSiqK BOi/9AgAsHPVzlJglzleNQFMFyxaqGkZkwgc5tOD3xnbqtN9QtO26R+8Aoq7BBSz Sh/g6gASRMZ+SLHQRN+kREceexYQE9Yj9/LQ5btjEEQDvtqCH18wFbKs8UPUrTM6 OVxPY2nABTwkAlPHflfFqZMj8e04Dj5xzINkzL5Y/zJb0EjQkW//vArdwsoN1MaZ Xl416b4G1VEvnRiL1r72stKahrdcatuVGeFiX3h/MaK9dxEh9TTDfbRBy4as9ffL ce5iKQRJRC2Cdwz1e59lQNS1Swk+uBuE70TNJmMD7+0oI6DG2HCulCIsPGoHxvii gpVabP87ZEiCOeIynVbyyJeYAxNsSA== =Ov1N -----END PGP SIGNATURE----- --yfy7e5plv3snihai--