On Thu, Nov 08, 2018 at 03:05:12PM +0100, Dimitrios Katsaros wrote:
> @@ -38,10 +38,11 @@
>  
>  static int phc_get_caps(clockid_t clkid, struct ptp_clock_caps *caps);
>  
> -clockid_t phc_open(char *phc)
> +clockid_t phc_open(const char *phc)
>  {
>       clockid_t clkid;
> -     struct ptp_clock_caps caps;
> +     struct timespec ts;
> +     struct timex tx;
>       int fd = open(phc, O_RDWR);
>  
>       if (fd < 0)
> @@ -49,7 +50,11 @@ clockid_t phc_open(char *phc)
>  
>       clkid = FD_TO_CLOCKID(fd);
>       /* check if clkid is valid */
> -     if (phc_get_caps(clkid, &caps)) {
> +     if (clock_gettime(clkid, &ts)) {
> +             close(fd);
> +             return CLOCK_INVALID;
> +     }
> +     if (clock_adjtime(clkid, &tx)) {

This fails because 'tx' is uninitialized stack data.  I fixed it up
and applied this patch.

Thanks,
Richard


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to