Commit d5f497b8 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Link: https://lore.kernel.org/r/20220318074723.GA6617@kiliSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 800c326b
...@@ -972,7 +972,7 @@ ptp_ocp_verify(struct ptp_clock_info *ptp_info, unsigned pin, ...@@ -972,7 +972,7 @@ ptp_ocp_verify(struct ptp_clock_info *ptp_info, unsigned pin,
switch (func) { switch (func) {
case PTP_PF_NONE: case PTP_PF_NONE:
sprintf(buf, "IN: None"); snprintf(buf, sizeof(buf), "IN: None");
break; break;
case PTP_PF_EXTTS: case PTP_PF_EXTTS:
/* Allow timestamps, but require sysfs configuration. */ /* Allow timestamps, but require sysfs configuration. */
...@@ -982,9 +982,9 @@ ptp_ocp_verify(struct ptp_clock_info *ptp_info, unsigned pin, ...@@ -982,9 +982,9 @@ ptp_ocp_verify(struct ptp_clock_info *ptp_info, unsigned pin,
* channels 1..4 are the frequency generators. * channels 1..4 are the frequency generators.
*/ */
if (chan) if (chan)
sprintf(buf, "OUT: GEN%d", chan); snprintf(buf, sizeof(buf), "OUT: GEN%d", chan);
else else
sprintf(buf, "OUT: PHC"); snprintf(buf, sizeof(buf), "OUT: PHC");
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
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