* [PATCH v2 net-next] ptp: ocp: use snprintf() in ptp_ocp_verify()
@ 2022-03-18 7:47 Dan Carpenter
2022-03-18 16:33 ` Jonathan Lemon
2022-03-19 4:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-03-18 7:47 UTC (permalink / raw)
To: Jonathan Lemon; +Cc: Jonathan Lemon, netdev, kernel-janitors
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>
---
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(-)
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;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net-next] ptp: ocp: use snprintf() in ptp_ocp_verify()
2022-03-18 7:47 [PATCH v2 net-next] ptp: ocp: use snprintf() in ptp_ocp_verify() Dan Carpenter
@ 2022-03-18 16:33 ` Jonathan Lemon
2022-03-19 4:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Lemon @ 2022-03-18 16:33 UTC (permalink / raw)
To: Dan Carpenter; +Cc: netdev, kernel-janitors
On Fri, Mar 18, 2022 at 10:47:23AM +0300, Dan Carpenter wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net-next] ptp: ocp: use snprintf() in ptp_ocp_verify()
2022-03-18 7:47 [PATCH v2 net-next] ptp: ocp: use snprintf() in ptp_ocp_verify() Dan Carpenter
2022-03-18 16:33 ` Jonathan Lemon
@ 2022-03-19 4:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-19 4:50 UTC (permalink / raw)
To: Dan Carpenter; +Cc: jonathan.lemon, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
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 of sprintf().
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-19 4:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-18 7:47 [PATCH v2 net-next] ptp: ocp: use snprintf() in ptp_ocp_verify() Dan Carpenter
2022-03-18 16:33 ` Jonathan Lemon
2022-03-19 4:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).