[LTP] [PATCH] lib/tst_cgroup: fix short reads of mems/cpus

Li Wang liwang@redhat.com
Tue Nov 10 02:47:34 CET 2020


On Mon, Nov 9, 2020 at 8:49 PM Jan Stancek <jstancek@redhat.com> wrote:

>
>
> ----- Original Message -----
> > On Wed, Nov 4, 2020 at 2:22 PM Li Wang <liwang@redhat.com> wrote:
> >
> > > ...
> > >> -       tst_cgroup_cpuset_read_files(PATH_TMP_CG_CST, "cpus", buf);
> > >> +       tst_cgroup_cpuset_read_files(PATH_TMP_CG_CST, "cpus", buf,
> > >> sizeof(buf));
> > >>         tst_cgroup_cpuset_write_files(PATH_TMP_CG_CST, "cpus", buf);
> > >> -       tst_cgroup_cpuset_read_files(PATH_TMP_CG_CST, "mems", mems);
> > >> +       tst_cgroup_cpuset_read_files(PATH_TMP_CG_CST, "mems", mems,
> > >> sizeof(buf));
> > >>
> > >
> > > sizeof() is generally used to calculate the size (in bytes) of a data
> type,
> > > e.g sizeof(char *).
> > > I think here to pass 'BUFSIZ' directly is better than sizeof(buf).
> > >
> >
> > Jan, do you agree with this point?
> > If yes, I can help to modify and apply this patch.
>
> 2nd line should have been sizeof(mems), but BUFSIZ will work too.
>

Pushed, thanks!

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201110/0ea7c10f/attachment-0001.htm>


More information about the ltp mailing list