mm: and drivers core: Convert hugetlb_report_node_meminfo to sysfs_emit

Convert the unbound sprintf in hugetlb_report_node_meminfo to use
sysfs_emit_at so that no possible overrun of a PAGE_SIZE buf can occur.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
Link: https://lore.kernel.org/r/894b351b82da6013cde7f36ff4b5493cd0ec30d0.1600285923.git.joe@perches.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Joe Perches
2020-09-16 13:40:43 -07:00
committed by Greg Kroah-Hartman
parent 948b3edba8
commit 7981593bf0
3 changed files with 13 additions and 11 deletions

View File

@@ -473,7 +473,7 @@ static ssize_t node_read_meminfo(struct device *dev,
HPAGE_PMD_NR)
#endif
);
len += hugetlb_report_node_meminfo(nid, buf + len);
len += hugetlb_report_node_meminfo(buf, len, nid);
return len;
}