----- On Mar 21, 2019, at 4:25 PM, Jeremie Galarneau 
jeremie.galarn...@efficios.com wrote:

[...]
>> +               assert(idx < events->wait.nb_fd);
> 
> Not needed. Using assert() is fine to highlight assumptions across
> interfaces/functions and/or catch catastrophic internal errors. Here,
> this would be a very local condition that seems to be already
> enforced.
> 
> Reworking the 'for' condition to use 'i < events->wait.nb_fd' and
> breaking out early of the loop is also an option here.

The reason for using assert() here is to ensure that there is no discrepancy
between the number of active poll fd in the set and the value returned by
poll indicating that same number of active fds.

We'd need a kernel bug (or memory corruption) to have a mismatch, but I thought
having an assert in there would not hurt, since it might help diagnose issues
that cross user-kernel boundaries.

Thoughts ?

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to