Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2595919rdb; Fri, 22 Sep 2023 03:25:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHd3BiXHzf5JobTINXu35TZiEhzVcIf8Gxf5LJbDDNB7CrXRh3I/zbtDFapRlsMyiYemToa X-Received: by 2002:a05:6a00:22c9:b0:68e:4587:3da8 with SMTP id f9-20020a056a0022c900b0068e45873da8mr8853982pfj.21.1695378340312; Fri, 22 Sep 2023 03:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695378340; cv=none; d=google.com; s=arc-20160816; b=pCmVQ+yK1mD7ZcOoIxI+MClf4sShYNkepEBpY6TlYZtQh/i9G+rcOgDtQOPVqGWzPI JH3SF43mM86rgwrUIeaa7qYskQ0kCGKE3lBojG3VDapSWamdL0Q9YctsAeaOF5goZvmI CIzU+aI2jOHoLdZGYriwX2ejUHAtM1k38ghc4A1pdts9QF17X8YALeuSqloIRurXdjaf WAXGT+DrH0S6OlA5mmLPJ9V7y1tV6GPg/tpzXfBgusD5i+Y39r9ImUGmubsyJV4wrnDs DhWw3RmRQZ5+y2zICXCo5mmFC3li6EkkR8vmaE1op2KiVsw//OGMXMM5RhtzermgyEqp JvSA== 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:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=vbO8jgJe6gu24HYuRyYHfto5Go4wb1NJ6yNbvgAP6xA=; fh=o+12BVaXoupWNlqNx4gGhd5gbJoOx5QmWbAZzC8j8/g=; b=XuesSb/oDExmd7viNnZ/o2N71bJGUL+z1msXxNIBBe43K3VJ/nz14GSW3TJFaW8Yfb mDCEQpLmmb0MrCk0zO+hY3jaS3TOZuY050yFyALZazNyUzmshwE7kPXGQAqeUXnYM5T9 ZxuYjxfmBdPpelLDvXwtHeICgL0suGW02nLdq9iKJItoS4OHtIXayWfgBv5XuQ2DQZR+ ByF3ubDfEC/EeNFgH5pzTwKQxMGxioy0MWrnzZBhBWSa/VGByGLIpWHWeVFkcMUgRUkQ oIv/i2wNyhkOD0TR+Ad0lLwpLDUf0U0aUA1N7EdhOJcqaNpmYOBk7v1avHoMfRvN71ux u6Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="u9Ta/PHx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e4-20020a635444000000b005774c90073asi3373584pgm.320.2023.09.22.03.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="u9Ta/PHx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id ABE668344A25; Fri, 22 Sep 2023 03:12:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbjIVKMP (ORCPT + 99 others); Fri, 22 Sep 2023 06:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbjIVKMO (ORCPT ); Fri, 22 Sep 2023 06:12:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B3594; Fri, 22 Sep 2023 03:12:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8DD1C433C7; Fri, 22 Sep 2023 10:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695377528; bh=KTp3+5YEfk8OXMEq9FRYbmvHCPYkW/LfzyG6e8jyrmE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u9Ta/PHxFGYtdvyR7EyjbHhgY2PgupOINSohq8W3l1y2ntQltHwu0DFxjAxonBPT3 j+A0gQaDzt+PaotHTBPHV10x7An3Gqxx4qdSFjsJWuFjln8X4f/3/34GTehDaGU0jh kYqssWzWSbSJfuTLNCxPyTaGGKnJHcegK5wcHIaXlWU6aE9j8VDt1kvluhd/2Le6a2 VGgnpL6DQAMQMhSsAZ5Kf7HGutE7W/yUIDTEj8mqPJGe8Lc5nNbStG5/CWh1MNnYV6 oroHipTH3ZVFkWBTIwNe6oXwzVDu4iolSrelgg6/AK41pCq+7WeOMRE9sUbh0lEG/n TUROSSffqfMPA== Date: Fri, 22 Sep 2023 12:12:05 +0200 From: Wolfram Sang To: Justin Stitt Cc: Andi Shyti , Michael Ellerman , Nicholas Piggin , Christophe Leroy , linux-i2c@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] i2c: replace deprecated strncpy Message-ID: Mail-Followup-To: Wolfram Sang , Justin Stitt , Andi Shyti , Michael Ellerman , Nicholas Piggin , Christophe Leroy , linux-i2c@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20230920-strncpy-drivers-i2c-busses-i2c-powermac-c-v1-1-0a3e9a107f8a@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9cBeMkCN/aqfYfhG" Content-Disposition: inline In-Reply-To: <20230920-strncpy-drivers-i2c-busses-i2c-powermac-c-v1-1-0a3e9a107f8a@google.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 03:12:16 -0700 (PDT) --9cBeMkCN/aqfYfhG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 20, 2023 at 11:07:35AM +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. >=20 > We should prefer more robust and less ambiguous string interfaces. >=20 > `info.type` is expected to be NUL-terminated judging by its use in > `i2c_new_client_device()` wherein it is used to populate `client->name`: > | strscpy(client->name, info->type, sizeof(client->name)); >=20 > NUL-padding is not required and even if it was, `client` is already > zero-initialized. >=20 > Considering the two points from above, 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 Added "powermac: " to $subject and applied to for-next, thanks! --9cBeMkCN/aqfYfhG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmUNaHUACgkQFA3kzBSg KbZm7RAAk1/spyitaQbYe3PLY8H0wGpdmUP+Yo6vjUIH/2oT5BZDL5XJev83mjnd GTIDBPXPr1YAK+qpPahs0BNLIVkE8qBXeQMyCfj7LJJcmnvvXuCjoUeyIGtciqLt y6tOXNy0PwN1KDKW2tE48CsY28VJeFJcXF/ZgGOcx+/FeWz6Fh4A+10fVnaPLPl5 J2iYBxmmrUT/heLsa0WDpuImW/k4iw37gLaEYIYjNlguYES0HgOe3zwQVGmzO38z xN3CZNr1vFQYqI8hCcZtFayOD50W5YHN88pMbEQC7WJc8Uij0fjdoWLwGLPxSfzn 9noJZkQXGnA7nr+jBM1A4X6uXywLFPacbcHYjcMHeePljzthLhrOuJOJCd96p0IF F4ckvd8AnRt0q3tXiracT+PnkXWlKGrREIkkxfdJ7L4OWTAzVQbRmcceXjO4+zac fWW/rnNblvanTac8r7gU0AtVSavJqCnRawLvOeiVxJcNUxSr8IX1w5GMnOkWXT+V YN9OP4iVcFFM8GEC3mbY49YOeO2z+4H79BjwXpef2lfYu6zYrDfYpgkMvrGjRXaZ Wp/V5GE1bXbWi3uQhe6F9ruU07xz1ZOEfnW6gVtTt6whyi6g1AksJHCHTcpF0Sna BIErf242wmZ6BSNpB/a60OXqcovC9Z1xQeXMUUzvdHIuUXZEZ7s= =8uVT -----END PGP SIGNATURE----- --9cBeMkCN/aqfYfhG--