tracing: Add support for dynamic strings to synthetic events
Hi,
Static analysis with Coverity has detected a duplicated condition in an if statement in the following commit in source kernel/trace/trace_events_synth.c
commit bd82631d7ccdc894af2738e47abcba2cb6e7dea9
Author: Tom Zanussi <[email protected]> Date: Sun Oct 4 17:14:06 2020 -0500
tracing: Add support for dynamic strings to synthetic events
Analysis is as follows:
493 for (i = 0; i < event->n_fields; i++) {
Same on both sides (CONSTANT_EXPRESSION_RESULT)pointless_expression: The expression event->fields[i]->is_dynamic && event->fields[i]->is_dynamic does not accomplish anything because it evaluates to either of its identical operands, event->fields[i]->is_dynamic.
Did you intend the operands to be different?
494 if (event->fields[i]->is_dynamic &&
495 event->fields[i]->is_dynamic)
496 pos += snprintf(buf + pos, LEN_OR_ZERO,
497 ", __get_str(%s)",
event->fields[i]->name);
498 else
499 pos += snprintf(buf + pos, LEN_OR_ZERO,
500 ", REC->%s",
event->fields[i]->name);
501 }
Colin
Quoted 21 lines · On Wed, 7 Oct 2020 14:08:38 +0100 Colin Ian King <[email protected]>…
Hi,
Static analysis with Coverity has detected a duplicated condition in an if statement in the following commit in source
kernel/trace/trace_events_synth.ccommit
bd82631d7ccdc894af2738e47abcba2cb6e7dea9Author: Tom Zanussi <[email protected]> Date: Sun Oct 4 17:14:06 2020 -0500tracing: Add support for dynamic strings to synthetic events
Analysis is as follows:
493 for (i = 0; i <
event->n_fields; i++) {Same on both sides (
CONSTANT_EXPRESSION_RESULT)pointless_expression: The expression event->fields[i]->is_dynamic && event->fields[i]->is_dynamic does not accomplish anything because it evaluates to either of its identical operands, event->fields[i]->is_dynamic.
Quoted 4 lines
Did you intend the operands to be different?
494 if (event->fields[i]->is_dynamic &&
495 event->fields[i]->is_dynamic)
Bah, I believe that was suppose to be:
if (event->fields[i]->is_string && event->fields[i]->is_dynamic)
I'll go and fix that.
-- Steve
Quoted 10 lines
496 pos += snprintf(buf + pos,
LEN_OR_ZERO,
497 ",__get_str(%s)",
event->fields[i]->name);
498 else
499 pos += snprintf(buf + pos,LEN_OR_ZERO,
500 ", REC->%s",
event->fields[i]->name);
501 }Colin
Quoted 29 lines · Steven Rostedt
Quoted 21 lines · On Wed, 7 Oct 2020 14:08:38 +0100 Colin Ian King <[email protected]>…
Hi,
Static analysis with Coverity has detected a duplicated condition in an if statement in the following commit in source
kernel/trace/trace_events_synth.ccommit
bd82631d7ccdc894af2738e47abcba2cb6e7dea9Author: Tom Zanussi <[email protected]> Date: Sun Oct 4 17:14:06 2020 -0500tracing: Add support for dynamic strings to synthetic events
Analysis is as follows:
493 for (i = 0; i <
event->n_fields; i++) {Same on both sides (
CONSTANT_EXPRESSION_RESULT)pointless_expression: The expression event->fields[i]->is_dynamic && event->fields[i]->is_dynamic does not accomplish anything because it evaluates to either of its identical operands, event->fields[i]->is_dynamic.Quoted 4 lines
Did you intend the operands to be different?
494 if (event->fields[i]->is_dynamic &&
495 event->fields[i]->is_dynamic)
Quoted 6 lines
Bah, I believe that was suppose to be:
if (event->fields[i]->is_string && event->fields[i]->is_dynamic)I'll go and fix that.
Ah, makes sense. Thanks!
Quoted 14 lines
-- Steve
Quoted 10 lines
496 pos += snprintf(buf + pos,
LEN_OR_ZERO,
497 ",__get_str(%s)",
event->fields[i]->name);
498 else
499 pos += snprintf(buf + pos,LEN_OR_ZERO,
500 ", REC->%s",
event->fields[i]->name);
501 }Colin
Tom Zanussi
Acked-byQuoted 33 lines · Steven Rostedt
Quoted 23 lines · On Wed, 7 Oct 2020 14:08:38 +0100 Colin Ian King <[email protected]>…
Hi,
Static analysis with Coverity has detected a duplicated condition in an
if statement in the following commit in sourcekernel/trace/trace_events_synth.ccommit
bd82631d7ccdc894af2738e47abcba2cb6e7dea9Author: Tom Zanussi <[email protected]> Date: Sun Oct 4 17:14:06 2020 -0500tracing: Add support for dynamic strings to synthetic events
Analysis is as follows:
493 for (i = 0; i <
event->n_fields; i++) {Same on both sides (
CONSTANT_EXPRESSION_RESULT)pointless_expression: The expression event->fields[i]->is_dynamic &&
event->fields[i]->is_dynamic does not accomplish anything because it
evaluates to either of its identical operands, event->fields[i]-Quoted 6 lines
Quoted 1 line
is_dynamic.Did you intend the operands to be different?
494 if (event->fields[i]->is_dynamic &&
495 event->fields[i]->is_dynamic)
Quoted 7 lines
Bah, I believe that was suppose to be:
if (event->fields[i]->is_string && event->fields[i]->is_dynamic)I'll go and fix that.
Yep, thanks for fixing that.
Tom
Quoted 14 lines
-- Steve
Quoted 10 lines
496 pos += snprintf(buf + pos,
LEN_OR_ZERO,
497 ",__get_str(%s)",
event->fields[i]->name);
498 else
499 pos += snprintf(buf + pos,LEN_OR_ZERO,
500 ", REC->%s",
event->fields[i]->name);
501 }Colin