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

Li Wang liwang@redhat.com
Mon Nov 9 10:23:30 CET 2020


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.

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


More information about the ltp mailing list