* [to-be-updated] mm-and-drivers-core-convert-hugetlb_report_node_meminfo-to-sysfs_emit.patch removed from -mm tree
@ 2020-09-19 3:37 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2020-09-19 3:37 UTC (permalink / raw)
To: mm-commits, rafael, mike.kravetz, julia.lawall, gregkh, efremov,
alex.dewar90, joe
The patch titled
Subject: mm: and drivers core: convert hugetlb_report_node_meminfo to sysfs_emit
has been removed from the -mm tree. Its filename was
mm-and-drivers-core-convert-hugetlb_report_node_meminfo-to-sysfs_emit.patch
This patch was dropped because an updated version will be merged
------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: 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.
Link: https://lkml.kernel.org/r/894b351b82da6013cde7f36ff4b5493cd0ec30d0.1600285923.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J.Wysocki" <rafael@kernel.org>
Cc: Denis Efremov <efremov@linux.com>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/base/node.c | 2 +-
include/linux/hugetlb.h | 4 ++--
mm/hugetlb.c | 18 ++++++++++--------
3 files changed, 13 insertions(+), 11 deletions(-)
--- a/drivers/base/node.c~mm-and-drivers-core-convert-hugetlb_report_node_meminfo-to-sysfs_emit
+++ a/drivers/base/node.c
@@ -467,7 +467,7 @@ static ssize_t node_read_meminfo(struct
HPAGE_PMD_NR)
#endif
);
- n += hugetlb_report_node_meminfo(nid, buf + n);
+ n += hugetlb_report_node_meminfo(buf, n, nid);
return n;
}
--- a/include/linux/hugetlb.h~mm-and-drivers-core-convert-hugetlb_report_node_meminfo-to-sysfs_emit
+++ a/include/linux/hugetlb.h
@@ -129,7 +129,7 @@ void __unmap_hugepage_range(struct mmu_g
unsigned long start, unsigned long end,
struct page *ref_page);
void hugetlb_report_meminfo(struct seq_file *);
-int hugetlb_report_node_meminfo(int, char *);
+int hugetlb_report_node_meminfo(char *buf, int len, int nid);
void hugetlb_show_meminfo(void);
unsigned long hugetlb_total_pages(void);
vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -245,7 +245,7 @@ static inline void hugetlb_report_meminf
{
}
-static inline int hugetlb_report_node_meminfo(int nid, char *buf)
+static inline int hugetlb_report_node_meminfo(char *buf, int len, int nid)
{
return 0;
}
--- a/mm/hugetlb.c~mm-and-drivers-core-convert-hugetlb_report_node_meminfo-to-sysfs_emit
+++ a/mm/hugetlb.c
@@ -3582,18 +3582,20 @@ void hugetlb_report_meminfo(struct seq_f
seq_printf(m, "Hugetlb: %8lu kB\n", total / 1024);
}
-int hugetlb_report_node_meminfo(int nid, char *buf)
+int hugetlb_report_node_meminfo(char *buf, int len, int nid)
{
struct hstate *h = &default_hstate;
+
if (!hugepages_supported())
return 0;
- return sprintf(buf,
- "Node %d HugePages_Total: %5u\n"
- "Node %d HugePages_Free: %5u\n"
- "Node %d HugePages_Surp: %5u\n",
- nid, h->nr_huge_pages_node[nid],
- nid, h->free_huge_pages_node[nid],
- nid, h->surplus_huge_pages_node[nid]);
+
+ return sysfs_emit_at(buf, len,
+ "Node %d HugePages_Total: %5u\n"
+ "Node %d HugePages_Free: %5u\n"
+ "Node %d HugePages_Surp: %5u\n",
+ nid, h->nr_huge_pages_node[nid],
+ nid, h->free_huge_pages_node[nid],
+ nid, h->surplus_huge_pages_node[nid]);
}
void hugetlb_show_meminfo(void)
_
Patches currently in -mm which might be from joe@perches.com are
checkpatch-test-git_dir-changes.patch
get_maintainer-add-test-for-file-in-vcs.patch
get_maintainer-exclude-maintainers-files-from-git-fallback.patch
checkpatch-move-repeated-word-test.patch
checkpatch-add-test-for-comma-use-that-should-be-semicolon.patch
checkpatch-warn-on-self-assignments.patch
checkpatch-allow-not-using-f-with-files-that-are-in-git.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-19 3:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 3:37 [to-be-updated] mm-and-drivers-core-convert-hugetlb_report_node_meminfo-to-sysfs_emit.patch removed from -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).