summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorPuranjay Mohan <puranjay@kernel.org>2026-08-04 06:45:53 -0700
committerAndrii Nakryiko <andrii@kernel.org>2026-08-05 10:44:35 -0700
commit8efd87051c3a2a054519955ca401229f4e84b310 (patch)
treedcee4a69e31a0439c157c2033b6c16c372a315e8 /tools/perf/scripts/python
parent363b15d8551ef6749fac410377a8422325008dae (diff)
bpf: Correct the overflow check comment in bpf_iter_num_next()
The comment on the s->cur + 1 >= s->end check claims the (s64) cast is needed to avoid overflow when s->cur == s->end == INT_MAX. It isn't: s->cur + 1 is computed in int and wraps before the cast, so the cast changes nothing (INT_MAX + 1 compares the same either way). The wraparound is the point. bpf_iter_num_new() sets s->cur = start - 1, which wraps to INT_MAX for start == INT_MIN, and the wrapping s->cur + 1 brings it back to start. (s64)s->cur + 1 would instead break iterators starting at INT_MIN. Drop the cast and reword the comment. No functional change; the wrap is well-defined under -fno-strict-overflow. Signed-off-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260804134601.2305303-2-puranjay@kernel.org
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions