threads / patch / 50992

patchtrace2: fix incorrect function pointer check

Subject: [PATCH] trace2: fix incorrect function pointer check

## tl;dr

4 messages between Apr 25, 2019 and Apr 29, 2019. Diffs are folded; open one to read it.

replies: 3people: 4as markdown or json

Josh Steadmon· Apr 25, 2019, 17:08 UTC · lore

Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl in its targets, rather than pfn_data_fl, which is not actually called.

Signed-off-by: Josh Steadmon <steadmon@google.com>
---
 trace2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to trace2.c +1 −1
diff --git a/trace2.c b/trace2.c
index 8bbad56887..a73cfdf6fe 100644
--- a/trace2.c
+++ b/trace2.c
@@ -717,7 +717,7 @@ void trace2_data_json_fl(const char *file, int line, const char *category,
 	us_elapsed_region = tr2tls_region_elasped_self(us_now);
 
 	for_each_wanted_builtin (j, tgt_j)
-		if (tgt_j->pfn_data_fl)
+		if (tgt_j->pfn_data_json_fl)
 			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
 						us_elapsed_region, category,
 						repo, key, value);
-- 
2.21.0.593.g511ec345e18-goog
Derrick Stolee· Apr 25, 2019, 18:46 UTC · re: Josh Steadmon · lore

Re: [PATCH] trace2: fix incorrect function pointer check

On 4/25/2019 1:08 PM, Josh Steadmon wrote:
> Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
> in its targets, rather than pfn_data_fl, which is not actually called.
[snip]
>  	for_each_wanted_builtin (j, tgt_j)
> -		if (tgt_j->pfn_data_fl)
> +		if (tgt_j->pfn_data_json_fl)
>  			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
Seems obviously correct. Thanks!
-Stolee
Junio C Hamano· Apr 26, 2019, 02:42 UTC · re: Derrick Stolee · lore

Re: [PATCH] trace2: fix incorrect function pointer check

Derrick Stolee <stolee@gmail.com> writes:
Show 14 quoted lines
> On 4/25/2019 1:08 PM, Josh Steadmon wrote:
>> Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
>> in its targets, rather than pfn_data_fl, which is not actually called.
>
> [snip]
>
>>  	for_each_wanted_builtin (j, tgt_j)
>> -		if (tgt_j->pfn_data_fl)
>> +		if (tgt_j->pfn_data_json_fl)
>>  			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
>
> Seems obviously correct. Thanks!
>
> -Stolee

Thanks, both. It is embarrassing and sad that nobody caught it before it hit my tree X-<.

Jeff Hostetler· Apr 29, 2019, 13:01 UTC · re: Josh Steadmon · lore

Re: [PATCH] trace2: fix incorrect function pointer check

On 4/25/2019 1:08 PM, Josh Steadmon wrote:
Show 22 quoted lines
> Fix trace2_data_json_fl() to check for the presence of pfn_data_json_fl
> in its targets, rather than pfn_data_fl, which is not actually called.
> 
> Signed-off-by: Josh Steadmon <steadmon@google.com>
> ---
>   trace2.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/trace2.c b/trace2.c
> index 8bbad56887..a73cfdf6fe 100644
> --- a/trace2.c
> +++ b/trace2.c
> @@ -717,7 +717,7 @@ void trace2_data_json_fl(const char *file, int line, const char *category,
>   	us_elapsed_region = tr2tls_region_elasped_self(us_now);
>   
>   	for_each_wanted_builtin (j, tgt_j)
> -		if (tgt_j->pfn_data_fl)
> +		if (tgt_j->pfn_data_json_fl)
>   			tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
>   						us_elapsed_region, category,
>   						repo, key, value);
> 
good catch.  thanks.
Jeff

← back to recent threads