Hi Vishal,
> > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c
> > b/tools/testing/selftests/cgroup/test_memcontrol.c
> > index b43da9bc20c4..8ef9c99a82eb 100644
> > --- a/tools/testing/selftests/cgroup/test_memcontrol.c
> > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c
> > @@ -61,6 +61,11 @@ int alloc_anon(const char *cgroup, void *arg)
> > char *buf, *ptr;
> >
> > buf = malloc(size);
> > + if (buf == NULL) {
> > + fprintf(stderr, "malloc() failed\n");
> > + return -1;
> > + }
> > +
> > for (ptr = buf; ptr < buf + size; ptr += PAGE_SIZE)
> > *ptr = 0;
>
> Every malloc() call in this file has this same pattern. Maybe we'd be
> better off making it a helper function?
>
> Either way:
> Reviewed-by: Vishal Moola <[email protected]>
Thanks for your review and valuable suggestion.
I agree with you, will refactor all malloc() checks into a common helper
function, and send out a v2 patch soon.
Best regards,
Hongfu Li