[PATCH 0/2] cppcheck 2.22.0 fixes
Two fixes for issues detected by cppcheck 2.22.0.
The first is a real simplification: a !partial_send guard in
tcp_data_from_tap() is always true when reached, because partial_send
causes an early return above it, so the condition is dropped.
The second is a false positive: cppcheck flags buf[n - 1] as a
potential negative index in passt-repair.c, not tracking that n < 0
and n < sizeof(*ev) are both handled before that point. The warning
is suppressed with an annotation.
Signed-off-by: Laurent Vivier
When partial_send is true, the code returns early at the "keep != -1 ||
partial_send" check before reaching the fin handling block. Therefore
the !partial_send guard on the fin handling is always true when reached
and can be removed.
Detected with cppcheck 2.22.0
Signed-off-by: Laurent Vivier
By the time we reach buf[n - 1] = '\0', n < 0 and n < sizeof(*ev)
are already handled above, so the index is always positive. Add a
cppcheck-suppress annotation to silence the false positive.
Signed-off-by: Laurent Vivier
participants (1)
-
Laurent Vivier