On Mon, Mar 25, 2019 at 07:46:19PM +0000, Patel, Vedang wrote:
> >> +static int check_offset_threshold(struct servo *s, int64_t offset)
> >> +{
> >> + uint64_t abs_offset = abs(offset);
> >
> > abs() returns an int...
> >
> >> + if (s->offset_threshold) {
> >> + if (abs_offset < INT64_MAX && abs_offset < s->offset_threshold
> > ^^^^^^^^^^^^^^^^^^^^^^
> > ... so this test is always true
> >
> Sorry I missed this. Will change it to INT_MAX.
But are you sure that works?
What happens when your 'int64_t offset' is degraded into an 'int' in
the call to abs()?
Better to use llabs(), don't you think?
Thanks,
Richard
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel