Commit 847648f8 authored by Mitch Williams's avatar Mitch Williams Committed by Kleber Sacilotto de Souza

i40e: use correct length for strncpy

BugLink: https://bugs.launchpad.net/bugs/1853881

[ Upstream commit 7eb74ff8 ]

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: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 406382e1
...@@ -605,7 +605,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf) ...@@ -605,7 +605,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf)
if (!IS_ERR_OR_NULL(pf->ptp_clock)) if (!IS_ERR_OR_NULL(pf->ptp_clock))
return 0; 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.owner = THIS_MODULE;
pf->ptp_caps.max_adj = 999999999; pf->ptp_caps.max_adj = 999999999;
pf->ptp_caps.n_ext_ts = 0; pf->ptp_caps.n_ext_ts = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment