ptp: ocp: use snprintf() in ptp_ocp_verify()
Subsystems (5)
PATCH v2 1/1 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().
---
v2: re-spin the patch based on the latest tree. It turns out that the code is not buggy so don't make the buffer larger and don't add a Fixes tag.
drivers/ptp/ptp_ocp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ptp/ptp_ocp.c +3 -3
@@ -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 ;
Signature · 1 line
2.20.1
Quoted 4 lines · Dan Carpenter
This code is fine, but it's easier to review if we use
snprintf()instead ofsprintf().Signed-off-by Dan Carpenter <[email protected]>
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 18 Mar 2022 10:47:23 +0300 you wrote:
This code is fine, but it's easier to review if we use
snprintf()instead ofsprintf().Signed-off-by Dan Carpenter <[email protected]>---
v2: re-spin the patch based on the latest tree. It turns out that the code is not buggy so don't make the buffer larger and don't add a Fixes tag.[...]
Here is the summary with links:
- [v2,net-next] ptp: ocp: use snprintf() in ptp_ocp_verify()
https://git.kernel.org/netdev/net-next/c/d5f497b88979
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html