Both 'rta' and 'rtb' are not properly initialized to zero.
Fixed this by assigning to correct argument to memset calls.
Fixes: bdb6a35883b0 ("linuxptp: add phc_ctl program to help debug PHC devices")
Signed-off-by: Wong Vee Khee <[email protected]>
---
phc_ctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phc_ctl.c b/phc_ctl.c
index 00d7a1c..673cb37 100644
--- a/phc_ctl.c
+++ b/phc_ctl.c
@@ -350,8 +350,8 @@ static int do_cmp(clockid_t clkid, int cmdc, char *cmdv[])
}
memset(&ts, 0, sizeof(ts));
- memset(&ts, 0, sizeof(rta));
- memset(&ts, 0, sizeof(rtb));
+ memset(&rta, 0, sizeof(rta));
+ memset(&rtb, 0, sizeof(rtb));
if (clock_gettime(CLOCK_REALTIME, &rta) ||
clock_gettime(clkid, &ts) ||
clock_gettime(CLOCK_REALTIME, &rtb)) {
--
2.17.0
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel