Message ID | YM31etbBvDRf+bgS@mwanda (mailing list archive) |
---|---|
State | Accepted |
Commit | faebad853455b7126450c1690f7c31e048213543 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,1/2] net: hns3: fix different snprintf() limit | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 9 of 9 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
Hello: This series was applied to netdev/net-next.git (refs/heads/master): On Sat, 19 Jun 2021 16:47:38 +0300 you wrote: > This patch doesn't affect runtime at all, it's just a correctness issue. > > The ptp->info.name[] buffer has 16 characters but the snprintf() limit > was capped at 32 characters. Fortunately, HCLGE_DRIVER_NAME is "hclge" > which isn't close to 16 characters so we're fine. > > Fixes: 0bf5eb788512 ("net: hns3: add support for PTP") > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > [...] Here is the summary with links: - [net-next,1/2] net: hns3: fix different snprintf() limit https://git.kernel.org/netdev/net-next/c/faebad853455 - [net-next,2/2] net: hns3: fix a double shift bug https://git.kernel.org/netdev/net-next/c/956c3ae411b2 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c index b3eb8f109dbb..3b1f84502e36 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c @@ -415,8 +415,6 @@ int hclge_ptp_get_ts_info(struct hnae3_handle *handle, static int hclge_ptp_create_clock(struct hclge_dev *hdev) { -#define HCLGE_PTP_NAME_LEN 32 - struct hclge_ptp *ptp; ptp = devm_kzalloc(&hdev->pdev->dev, sizeof(*ptp), GFP_KERNEL); @@ -424,7 +422,7 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev) return -ENOMEM; ptp->hdev = hdev; - snprintf(ptp->info.name, HCLGE_PTP_NAME_LEN, "%s", + snprintf(ptp->info.name, sizeof(ptp->info.name), "%s", HCLGE_DRIVER_NAME); ptp->info.owner = THIS_MODULE; ptp->info.max_adj = HCLGE_PTP_CYCLE_ADJ_MAX;
This patch doesn't affect runtime at all, it's just a correctness issue. The ptp->info.name[] buffer has 16 characters but the snprintf() limit was capped at 32 characters. Fortunately, HCLGE_DRIVER_NAME is "hclge" which isn't close to 16 characters so we're fine. Fixes: 0bf5eb788512 ("net: hns3: add support for PTP") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)