From patchwork Sun Oct 6 17:19:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 1172610 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=perches.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46mmqz3fWsz9sCJ for ; Mon, 7 Oct 2019 14:56:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 78A98204EF; Mon, 7 Oct 2019 03:56:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v-j+mCYpW922; Mon, 7 Oct 2019 03:56:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id AF26D2012D; Mon, 7 Oct 2019 03:56:23 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 76E0D1BF33E for ; Mon, 7 Oct 2019 03:56:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 727532012D for ; Mon, 7 Oct 2019 03:56:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R6eY1IXEGk0D for ; Mon, 7 Oct 2019 03:56:21 +0000 (UTC) X-Greylist: delayed 08:10:01 by SQLgrey-1.7.6 Received: from smtprelay.hostedemail.com (smtprelay0167.hostedemail.com [216.40.44.167]) by silver.osuosl.org (Postfix) with ESMTPS id 6C1A920025 for ; Mon, 7 Oct 2019 03:56:21 +0000 (UTC) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave06.hostedemail.com (Postfix) with ESMTP id E9BE8800E2DA for ; Sun, 6 Oct 2019 17:19:15 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 41882180A68B1; Sun, 6 Oct 2019 17:19:13 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::, RULES_HIT:41:152:355:379:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2376:2393:2553:2559:2562:2903:3138:3139:3140:3141:3142:3352:3865:3867:3868:3871:3872:4321:5007:8603:10004:10400:10848:11026:11473:11657:11658:11914:12043:12262:12297:12438:12555:12679:12740:12895:12986:13069:13311:13357:13894:14096:14097:14181:14659:14721:21080:21365:21433:21451:21627:30054:30055:30064:30091, 0, RBL:error, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:neutral, Custom_rules:0:0:0, LFtime:260, LUA_SUMMARY:none X-HE-Tag: road46_333b5ec2ba205 X-Filterd-Recvd-Size: 2145 Received: from XPS-9350.home (unknown [47.151.152.152]) (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA; Sun, 6 Oct 2019 17:19:11 +0000 (UTC) Message-ID: From: Joe Perches To: Jeff Kirsher , intel-wired-lan@lists.osuosl.org, netdev Date: Sun, 06 Oct 2019 10:19:10 -0700 User-Agent: Evolution 3.32.1-2 MIME-Version: 1.0 Subject: [Intel-wired-lan] i40e_pto.c: Odd use of strlcpy converted from strncpy X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Patryk =?utf-8?b?TWHFgmVr?= Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 --- 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;