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>
Signed-off-by: David S. Miller <davem@davemloft.net>
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);
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;