* [PATCH 23.11] examples/ptpclient: fix message parsing
@ 2025-02-19 17:16 Stephen Hemminger
2025-04-05 7:38 ` Xueming Li
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2025-02-19 17:16 UTC (permalink / raw)
To: stable; +Cc: Stephen Hemminger
[ upstream commit 19630bd0d735badb06143086d4f1c50d726b7bad ]
Calling memcmp on same structure will always be true.
Replace with same conditional used elsewhere.
Link: https://pvs-studio.com/en/blog/posts/cpp/1183/
Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ptpclient/ptpclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index cdf2da64df..92b54f240e 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -365,7 +365,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx)
ptp_data->ptpset = 1;
}
- if (memcmp(&ptp_hdr->source_port_id.clock_id,
+ if (memcmp(&ptp_hdr->master_clock_id,
&ptp_hdr->source_port_id.clock_id,
sizeof(struct clock_id)) == 0) {
--
2.47.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 23.11] examples/ptpclient: fix message parsing
2025-02-19 17:16 [PATCH 23.11] examples/ptpclient: fix message parsing Stephen Hemminger
@ 2025-04-05 7:38 ` Xueming Li
2025-04-05 8:00 ` Xueming Li
0 siblings, 1 reply; 3+ messages in thread
From: Xueming Li @ 2025-04-05 7:38 UTC (permalink / raw)
To: Stephen Hemminger, stable
[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]
Thanks, patch queued to 23.11.4 release staging
Regards,
Xueming
________________________________
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Thursday, February 20, 2025 1:16 AM
To: stable@dpdk.org <stable@dpdk.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 23.11] examples/ptpclient: fix message parsing
[ upstream commit 19630bd0d735badb06143086d4f1c50d726b7bad ]
Calling memcmp on same structure will always be true.
Replace with same conditional used elsewhere.
Link: https://pvs-studio.com/en/blog/posts/cpp/1183/
Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ptpclient/ptpclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index cdf2da64df..92b54f240e 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -365,7 +365,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx)
ptp_data->ptpset = 1;
}
- if (memcmp(&ptp_hdr->source_port_id.clock_id,
+ if (memcmp(&ptp_hdr->master_clock_id,
&ptp_hdr->source_port_id.clock_id,
sizeof(struct clock_id)) == 0) {
--
2.47.2
[-- Attachment #2: Type: text/html, Size: 3375 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 23.11] examples/ptpclient: fix message parsing
2025-04-05 7:38 ` Xueming Li
@ 2025-04-05 8:00 ` Xueming Li
0 siblings, 0 replies; 3+ messages in thread
From: Xueming Li @ 2025-04-05 8:00 UTC (permalink / raw)
To: Stephen Hemminger, stable
[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]
Hi Stephen,
Found a compilation issue, I made following change to make it work, let me know if you have any questions:
- if (memcmp(&ptp_hdr->master_clock_id,
+ if (memcmp(&ptp_data->master_clock_id,
Regards,
Xueming
________________________________
From: Xueming Li
Sent: Saturday, April 5, 2025 3:38 PM
To: Stephen Hemminger; stable@dpdk.org
Subject: Re: [PATCH 23.11] examples/ptpclient: fix message parsing
Thanks, patch queued to 23.11.4 release staging
Regards,
Xueming
________________________________
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Thursday, February 20, 2025 1:16 AM
To: stable@dpdk.org <stable@dpdk.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 23.11] examples/ptpclient: fix message parsing
[ upstream commit 19630bd0d735badb06143086d4f1c50d726b7bad ]
Calling memcmp on same structure will always be true.
Replace with same conditional used elsewhere.
Link: https://pvs-studio.com/en/blog/posts/cpp/1183/
Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ptpclient/ptpclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index cdf2da64df..92b54f240e 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -365,7 +365,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx)
ptp_data->ptpset = 1;
}
- if (memcmp(&ptp_hdr->source_port_id.clock_id,
+ if (memcmp(&ptp_hdr->master_clock_id,
&ptp_hdr->source_port_id.clock_id,
sizeof(struct clock_id)) == 0) {
--
2.47.2
[-- Attachment #2: Type: text/html, Size: 5644 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-05 8:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-19 17:16 [PATCH 23.11] examples/ptpclient: fix message parsing Stephen Hemminger
2025-04-05 7:38 ` Xueming Li
2025-04-05 8:00 ` Xueming Li
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).