Re: [PATCH v5 3/4] mm/page_owner: Print memcg information

From: Michal Hocko
Date: Tue Feb 08 2022 - 10:20:53 EST


On Tue 08-02-22 13:13:15, Michal Hocko wrote:
> On Mon 07-02-22 19:05:31, Waiman Long wrote:
[...]
> > + ret += scnprintf(kbuf + ret, count - ret, "\n");
>
> I do not see any overflow prevention here. I believe you really need to
> check ret >= count after each scnprintf/cgroup_name.

OK, I have only now realized that scnprintf would return size - 1 on
overflow so explicitly checking for the overlow shouldn't be reallu
necessary.
--
Michal Hocko
SUSE Labs