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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C5DAC47404 for ; Mon, 7 Oct 2019 20:44:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 084EF2084D for ; Mon, 7 Oct 2019 20:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728718AbfJGUoN (ORCPT ); Mon, 7 Oct 2019 16:44:13 -0400 Received: from mga05.intel.com ([192.55.52.43]:26406 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbfJGUoN (ORCPT ); Mon, 7 Oct 2019 16:44:13 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 13:44:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,269,1566889200"; d="asc'?scan'208";a="394457126" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.96]) by fmsmga006.fm.intel.com with ESMTP; 07 Oct 2019 13:44:12 -0700 Message-ID: Subject: Re: i40e_pto.c: Odd use of strlcpy converted from strncpy From: Jeff Kirsher Reply-To: jeffrey.t.kirsher@intel.com To: Joe Perches , intel-wired-lan@lists.osuosl.org, netdev Cc: Mitch Williams , Patryk =?UTF-8?Q?Ma=C5=82ek?= Date: Mon, 07 Oct 2019 13:44:11 -0700 In-Reply-To: References: Organization: Intel Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-7z2uVr0ArLU7yfEvLYqf" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org --=-7z2uVr0ArLU7yfEvLYqf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2019-10-06 at 10:19 -0700, Joe Perches wrote: > This got converted from strncpy to strlcpy but it's > now not necessary to use one character less than the > actual size. >=20 > Perhaps the sizeof() - 1 is now not correct and it > should use strscpy and a normal sizeof. >=20 > from: >=20 > commit 7eb74ff891b4e94b8bac48f648a21e4b94ddee64 > Author: Mitch Williams > Date: Mon Aug 20 08:12:30 2018 -0700 >=20 > i40e: use correct length for strncpy >=20 > and >=20 > commit 4ff2d8540321324e04c1306f85d4fe68a0c2d0ae > Author: Patryk Ma=C5=82ek > Date: Tue Oct 30 10:50:44 2018 -0700 >=20 > i40e: Replace strncpy with strlcpy to ensure null termination Looks like you have a typo in the subject, s/i40e_pto.c/i40e_ptp.c/. You are also missing you signed-off-by: and Fixes:, I can get your change under test in the meantime to confirm your fix. > --- > drivers/net/ethernet/intel/i40e/i40e_ptp.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c > b/drivers/net/ethernet/intel/i40e/i40e_ptp.c > index 9bf1ad4319f5..627b1c02bb4b 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c > @@ -700,8 +700,8 @@ static long i40e_ptp_create_clock(struct i40e_pf > *pf) > if (!IS_ERR_OR_NULL(pf->ptp_clock)) > return 0; > =20 > - strlcpy(pf->ptp_caps.name, i40e_driver_name, > - sizeof(pf->ptp_caps.name) - 1); > + strscpy(pf->ptp_caps.name, i40e_driver_name, sizeof(pf- > >ptp_caps.name)); > + > pf->ptp_caps.owner =3D THIS_MODULE; > pf->ptp_caps.max_adj =3D 999999999; > pf->ptp_caps.n_ext_ts =3D 0; >=20 >=20 --=-7z2uVr0ArLU7yfEvLYqf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiTyZWz+nnTrOJ1LZ5W/vlVpL7c4FAl2bo5sACgkQ5W/vlVpL 7c7A/A//TFv2ges65eXffdGEeIeVqNUr6O2L2LlRXuHfmzJXqiVnV2i8U3bV+SMf P3yskWbSyiL7BS2fi34rFsyZhImT6MzGwdIC4fRmn+pRgPLTouM4AL6p4A0JeLXn KPNt8POTXg8ETlwovOfpY67xDEmgn9C9+GN3/7lYHOCROpY25AEYPk1Bo9u5Iw5Q 31drnh6M+sSdxWrcT5o3EHzfHPbhxJ4mP0lu+Gd3mKe2boIN0Du3BDkVQtK5ryQn gqtp6ns8PA+4Eq15R30/IYF6mMKIz6X/06NWjmK18mFNUs5Z9I0vo613BaOQ3iX5 Pk7VZ6nlKsUyP2btwjlSFfJjeX2NBlPDyrjsBvWmAeRrD0y08mcN3slv8seEEMeX 2eyDfZ2l4PY7PmVM2CddLJrpkoNzbHp5eEPlfiy0V3SE9F5XJQtQZ0citWul+p0C gaij35pW/B7JK9btdFry93Q22zfsV797J1XLkRkLni0+KGzIJMVbRiwBsNWPxIP4 K11Pv+fi0SBkeDiChQ/3ED5QJRbV2dPLb7HAIlzPYoB6fsZdTTJJpKAP/cTawEJA qAwiO2DVBipJwqP1nHBdQcUJCLo0QgkdfrGONRgSQURxY4Al/9Ra4IJFcoiphq4P SH+vQcaQcfYNSwyE7Tdxaa5YGnZPdw7naFJuSy3PpUq1CB9K8Oo= =XpGh -----END PGP SIGNATURE----- --=-7z2uVr0ArLU7yfEvLYqf-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Kirsher Date: Mon, 07 Oct 2019 13:44:11 -0700 Subject: [Intel-wired-lan] i40e_pto.c: Odd use of strlcpy converted from strncpy In-Reply-To: References: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: intel-wired-lan@osuosl.org List-ID: On Sun, 2019-10-06 at 10:19 -0700, Joe Perches wrote: > This got converted from strncpy to strlcpy but it's > now not necessary to use one character less than the > actual size. > > Perhaps the sizeof() - 1 is now not correct and it > should use strscpy and a normal sizeof. > > from: > > commit 7eb74ff891b4e94b8bac48f648a21e4b94ddee64 > Author: Mitch Williams > Date: Mon Aug 20 08:12:30 2018 -0700 > > i40e: use correct length for strncpy > > and > > commit 4ff2d8540321324e04c1306f85d4fe68a0c2d0ae > Author: Patryk Ma?ek > Date: Tue Oct 30 10:50:44 2018 -0700 > > i40e: Replace strncpy with strlcpy to ensure null termination Looks like you have a typo in the subject, s/i40e_pto.c/i40e_ptp.c/. You are also missing you signed-off-by: and Fixes:, I can get your change under test in the meantime to confirm your fix. > --- > drivers/net/ethernet/intel/i40e/i40e_ptp.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c > b/drivers/net/ethernet/intel/i40e/i40e_ptp.c > index 9bf1ad4319f5..627b1c02bb4b 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c > @@ -700,8 +700,8 @@ static long i40e_ptp_create_clock(struct i40e_pf > *pf) > if (!IS_ERR_OR_NULL(pf->ptp_clock)) > return 0; > > - strlcpy(pf->ptp_caps.name, i40e_driver_name, > - sizeof(pf->ptp_caps.name) - 1); > + strscpy(pf->ptp_caps.name, i40e_driver_name, sizeof(pf- > >ptp_caps.name)); > + > pf->ptp_caps.owner = THIS_MODULE; > pf->ptp_caps.max_adj = 999999999; > pf->ptp_caps.n_ext_ts = 0; > > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: