linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: tracing: Add support for dynamic strings to synthetic events
@ 2020-10-07 13:08 Colin Ian King
  2020-10-07 13:30 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Ian King @ 2020-10-07 13:08 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: Steven Rostedt, Ingo Molnar, linux-kernel

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 <zanussi@kernel.org>
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tracing: Add support for dynamic strings to synthetic events
  2020-10-07 13:08 tracing: Add support for dynamic strings to synthetic events Colin Ian King
@ 2020-10-07 13:30 ` Steven Rostedt
  2020-10-07 13:35   ` Colin Ian King
  2020-10-07 14:27   ` Tom Zanussi
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Rostedt @ 2020-10-07 13:30 UTC (permalink / raw)
  To: Colin Ian King; +Cc: Tom Zanussi, Ingo Molnar, linux-kernel

On Wed, 7 Oct 2020 14:08:38 +0100
Colin Ian King <colin.king@canonical.com> wrote:

> 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 <zanussi@kernel.org>
> 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)

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

> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tracing: Add support for dynamic strings to synthetic events
  2020-10-07 13:30 ` Steven Rostedt
@ 2020-10-07 13:35   ` Colin Ian King
  2020-10-07 14:27   ` Tom Zanussi
  1 sibling, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2020-10-07 13:35 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Tom Zanussi, Ingo Molnar, linux-kernel

On 07/10/2020 14:30, Steven Rostedt wrote:
> On Wed, 7 Oct 2020 14:08:38 +0100
> Colin Ian King <colin.king@canonical.com> wrote:
> 
>> 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 <zanussi@kernel.org>
>> 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)
> 
> 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!

> 
> -- Steve
> 
>> 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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tracing: Add support for dynamic strings to synthetic events
  2020-10-07 13:30 ` Steven Rostedt
  2020-10-07 13:35   ` Colin Ian King
@ 2020-10-07 14:27   ` Tom Zanussi
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Zanussi @ 2020-10-07 14:27 UTC (permalink / raw)
  To: Steven Rostedt, Colin Ian King; +Cc: Ingo Molnar, linux-kernel

On Wed, 2020-10-07 at 09:30 -0400, Steven Rostedt wrote:
> On Wed, 7 Oct 2020 14:08:38 +0100
> Colin Ian King <colin.king@canonical.com> wrote:
> 
> > 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 <zanussi@kernel.org>
> > 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)
> 
> 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.

Acked-by: Tom Zanussi <zanussi@kernel.org>


Tom

> -- Steve
> 
> > 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
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-07 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 13:08 tracing: Add support for dynamic strings to synthetic events Colin Ian King
2020-10-07 13:30 ` Steven Rostedt
2020-10-07 13:35   ` Colin Ian King
2020-10-07 14:27   ` Tom Zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).