Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp142425ybc; Mon, 18 Nov 2019 22:05:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxRioC7G2NqFlc0RcOPysEHnE8bf+8vGM8TPTVVKBnscmqY9hZBcHhbqugcS2UE0BxvUMie X-Received: by 2002:a17:906:52c3:: with SMTP id w3mr33188533ejn.122.1574143521439; Mon, 18 Nov 2019 22:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574143521; cv=none; d=google.com; s=arc-20160816; b=JLo2WNc5NWi3gcrFby98BBrwCdg9QK1+2Mm0A97tor2AklZrpslUCvRTRbhyPjz+Kc eMNNmYgxSqaiEZ7X78dEBSucyXVW/Jw2G0upjrFPg+BNKqLsM75QgXqPYKSGLmEjdRou hFyR4v+CYFYdlu4fOiJo4DJbR5jqxEPdkxbZLzQL6VZMImkyo3av3RcNdqDQS97+m6Ym iTuHoABFKQ6PxZ+Dj0cV5e0zbb/h+FiWuy/Mz2kpE0i9UuWjXqiPa7DkPKR1Bi99vJwD 7hvnWXu7sr649JNZR5Axl7cNuFx/5wz7C6e1o8IKdcsiG6uF8OdkHbCfm1N/pqEzWIDI Fu4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wqC4TeJnvk92x6LatgwYCyUwQNBwtCoxeSJruo1/yqw=; b=NlF1ztYimy88R/JPc5JmEiHxwgeDsYoP6IZvT4MEvdUI6L4DcoEG1amnYxV2Y6nsbE nazY/O3B1YGqn18PnoaUzn7lewtGmia4xEyKEn/YC/BAm1tlVxYI+BR5KETAgkWjF35r jAq0SqgyCZUTT1aTHGGg3IYE3Gzuo3Lyr8VSst0r7hP0Fm8jAx9QkxPz6YS2ad9OXzeX HIi+bxdPLHC5p3ByoxZEwTX26rqMQy4c7ueoR4xYUHLx0KWp/X+adOE2Cjil50xz4HFF kAkHbO5Zsm4USdra+UObuaAVsIyi1ZgvDoalHb1pnZeylS8M3R+92X5qstNs/qtesuGs ucEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SXY9QJor; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j18si15458286eda.278.2019.11.18.22.04.57; Mon, 18 Nov 2019 22:05:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SXY9QJor; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728132AbfKSGA0 (ORCPT + 99 others); Tue, 19 Nov 2019 01:00:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:41578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728009AbfKSFpr (ORCPT ); Tue, 19 Nov 2019 00:45:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2CCFC2075E; Tue, 19 Nov 2019 05:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142346; bh=L/S6jj7DjumFJ+aYhX8gtox1aMBuIiR/X1oK5cVsu1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SXY9QJor5QHutRsDpQ6l4He79eLJEk6KmRUJZFVTnga0h5U4L8mloIPiuTJw6YxSC LS1eQfptlQUtMQhRkY3aKF50QF9guU55xsseZmlaq35Yfb1hs0Nbt28jcfNOCHRhLi ZTTWlVGOz8C5XMMBeEwhSN3vzhb/yGjJXCfp5pkk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mitch Williams , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.14 051/239] i40e: use correct length for strncpy Date: Tue, 19 Nov 2019 06:17:31 +0100 Message-Id: <20191119051307.569380070@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mitch Williams [ Upstream commit 7eb74ff891b4e94b8bac48f648a21e4b94ddee64 ] Caught by GCC 8. When we provide a length for strncpy, we should not include the terminating null. So we must tell it one less than the size of the destination buffer. Signed-off-by: Mitch Williams Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index ef242dbae116b..5fc8707574809 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -704,7 +704,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf) if (!IS_ERR_OR_NULL(pf->ptp_clock)) return 0; - strncpy(pf->ptp_caps.name, i40e_driver_name, sizeof(pf->ptp_caps.name)); + strncpy(pf->ptp_caps.name, i40e_driver_name, + sizeof(pf->ptp_caps.name) - 1); pf->ptp_caps.owner = THIS_MODULE; pf->ptp_caps.max_adj = 999999999; pf->ptp_caps.n_ext_ts = 0; -- 2.20.1