> > @@ -1693,7 +1694,10 @@ int main(void)
> >             printf("running PKEY tests for unsupported CPU/OS\n");
> >  
> >             ptr  = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, 
> > -1, 0);
> > -           assert(ptr != (void *)-1);
> > +           if (ptr == MAP_FAILED) {
> > +                   perror("mmap");
> > +                   return EXIT_FAILURE;
> > +           }
> 
> Just stick to pkey_assert() everywhere, it already prints errno and exits.

This is a pre-test initialization path that runs before the test loop,
so test_nr and iteration_nr are not yet set up for pkey_assert().

Should we just use their initial values here directly?
 
> >             test_mprotect_pkey_on_unsupported_cpu(ptr, 1);
> >             exit(0);
> >     }
> > @@ -1706,5 +1710,5 @@ int main(void)
> >             run_tests_once();
> >  
> >     printf("done (all tests OK)\n");
> > -   return 0;
> > +   return EXIT_SUCCESS;
> 
> Completely unrelated and not needed.
> 
> And you may want to base your work on mm-unstable to get up to date version
> of protection_keys tests.

Sure, I will base my changes on top of the latest mm-unstable branch.

Best regards,
Hongfu

Reply via email to