summaryrefslogtreecommitdiffstats
path: root/drivers/ptp
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-03-18 10:47:23 +0300
committerJakub Kicinski <kuba@kernel.org>2022-03-18 21:42:09 -0700
commitd5f497b889794161facc1522d86720b587d1c0b7 (patch)
treef07f34205aba5f68605a210b886696eaa9b2e262 /drivers/ptp
parent800c326bfa9cee38f0e173733ce9f93492c84c8b (diff)
downloadlinux-stable-d5f497b889794161facc1522d86720b587d1c0b7.tar.gz
linux-stable-d5f497b889794161facc1522d86720b587d1c0b7.tar.bz2
linux-stable-d5f497b889794161facc1522d86720b587d1c0b7.zip
ptp: ocp: use snprintf() in ptp_ocp_verify()
This code is fine, but it's easier to review if we use snprintf() instead of sprintf(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com> Link: https://lore.kernel.org/r/20220318074723.GA6617@kili Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_ocp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index d64a1ce5f5bc..c3d0fcf609e3 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -972,7 +972,7 @@ ptp_ocp_verify(struct ptp_clock_info *ptp_info, unsigned pin,
switch (func) {
case PTP_PF_NONE:
- sprintf(buf, "IN: None");
+ snprintf(buf, sizeof(buf), "IN: None");
break;
case PTP_PF_EXTTS:
/* Allow timestamps, but require sysfs configuration. */
@@ -982,9 +982,9 @@ ptp_ocp_verify(struct ptp_clock_info *ptp_info, unsigned pin,
* channels 1..4 are the frequency generators.
*/
if (chan)
- sprintf(buf, "OUT: GEN%d", chan);
+ snprintf(buf, sizeof(buf), "OUT: GEN%d", chan);
else
- sprintf(buf, "OUT: PHC");
+ snprintf(buf, sizeof(buf), "OUT: PHC");
break;
default:
return -EOPNOTSUPP;