Re: [igt-dev] [PATCH i-g-t 08/21] benchmarks/wsim: Handle a parse error

Petri Latvala
2019-01-16T12:03:09Z

On Wed, Jan 16, 2019 at 11:45:38AM +0000, Tvrtko Ursulin wrote:
>
> On 16/01/2019 11:20, Petri Latvala wrote:
> > Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> > benchmarks/gem_wsim.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
> > index e0709487..5a4753d9 100644
> > --- a/benchmarks/gem_wsim.c
> > +++ b/benchmarks/gem_wsim.c
> > @@ -483,6 +483,14 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w)
> > goto add_step;
> > }
> > + if (!field) {
>
> field has already been checked to be valid in this block:
>
> if ((field = strtok_r(fstart, ".", &fctx))) {

field will be assigned again in the above if blocks. An example test
case for this is:

# cat foo.wsim
a

# gem_wsim_bench -n 1 -w foo.wsim
Segmentation fault

--
Petri Latvala