linux-6.6/tools/perf/util/bpf_map.c:50:8: style: Suspicious condition

From: David Binderman
Date: Fri Nov 10 2023 - 14:19:55 EST


Hello there,

Static analyser cppcheck says:

linux-6.6/tools/perf/util/bpf_map.c:50:8: style: Suspicious condition (assignment + comparison); Clarify expression with parentheses. [clarifyCondition]

Source code is

while ((err = bpf_map_get_next_key(fd, prev_key, key) == 0)) {

Suggest new code:

while ((err = bpf_map_get_next_key(fd, prev_key, key)) == 0) {

Regards

David Binderman