From: Sergey Organov Date: Wed, 15 Jul 2020 15:43:00 +0000 (+0300) Subject: net: fec: replace snprintf() with strlcpy() in fec_ptp_init() X-Git-Tag: v5.9-rc1~133^2~229^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31bb1a560b2996f9953cfc232f6349d043aaab49;p=thirdparty%2Fkernel%2Flinux.git net: fec: replace snprintf() with strlcpy() in fec_ptp_init() No need to use snprintf() on a constant string, nor using magic constant in the fixed code was a good idea. Signed-off-by: Sergey Organov Acked-by: Fugang Duan Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 0c8c56bdd7ac2..93a86553147c4 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -570,7 +570,7 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) int ret; fep->ptp_caps.owner = THIS_MODULE; - snprintf(fep->ptp_caps.name, 16, "fec ptp"); + strlcpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name)); fep->ptp_caps.max_adj = 250000000; fep->ptp_caps.n_alarm = 0;