[igt-dev] [PATCH i-g-t 3/3] overlay: fix invalid pointer access

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 1 17:46:07 UTC 2018


Quoting Lionel Landwerlin (2018-02-01 17:32:16)
> The 'v' variable isn't defined in this part of the 'TracepointFmt'
> rule but because of the way the generator produces code (one function
> per rule) it doesn't realize we're accessing a variable from a
> different case of the rule and this doesn't lead to a C compiler error
> on undefined variable.
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  overlay/tracepoint_format.leg | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/overlay/tracepoint_format.leg b/overlay/tracepoint_format.leg
> index 0db9a55f..5503e1cc 100644
> --- a/overlay/tracepoint_format.leg
> +++ b/overlay/tracepoint_format.leg
> @@ -1,5 +1,5 @@
>  TracepointFmt =
> -    'name' ':' Space n:PropertyName EndLine { free(v.string); }
> +    'name' ':' Space n:PropertyName EndLine { free(n.string); }

Oh, and I think I can even parse this snippet!

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list