Skip to content

Commit

Permalink
ptp: ocp: use snprintf() in ptp_ocp_verify()
Browse files Browse the repository at this point in the history
This code is fine, but it's easier to review if we use snprintf()
instead of sprintf().

Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Jonathan Lemon <[email protected]>
Link: https://lore.kernel.org/r/20220318074723.GA6617@kili
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Dan Carpenter authored and kuba-moo committed Mar 19, 2022
1 parent 800c326 commit d5f497b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/ptp/ptp_ocp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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;
Expand Down

0 comments on commit d5f497b

Please sign in to comment.