]> git.ipfire.org Git - people/arne_f/kernel.git/blobdiff - mm/vmstat.c
usb: core: fix slab-out-of-bounds Read in read_descriptors
[people/arne_f/kernel.git] / mm / vmstat.c
index 4bb13e72ac97c58e98cc77227a5107cd2c34c471..e2197b03da574876113281dba1b316b8c9019f33 100644 (file)
@@ -1090,6 +1090,7 @@ const char * const vmstat_text[] = {
        "nr_vmscan_immediate_reclaim",
        "nr_dirtied",
        "nr_written",
+       "", /* nr_indirectly_reclaimable */
 
        /* enum writeback_stat_item counters */
        "nr_dirty_threshold",
@@ -1200,10 +1201,8 @@ const char * const vmstat_text[] = {
 #endif
 #endif /* CONFIG_MEMORY_BALLOON */
 #ifdef CONFIG_DEBUG_TLBFLUSH
-#ifdef CONFIG_SMP
        "nr_tlb_remote_flush",
        "nr_tlb_remote_flush_received",
-#endif /* CONFIG_SMP */
        "nr_tlb_local_flush_all",
        "nr_tlb_local_flush_one",
 #endif /* CONFIG_DEBUG_TLBFLUSH */
@@ -1211,7 +1210,6 @@ const char * const vmstat_text[] = {
 #ifdef CONFIG_DEBUG_VM_VMACACHE
        "vmacache_find_calls",
        "vmacache_find_hits",
-       "vmacache_full_flushes",
 #endif
 #ifdef CONFIG_SWAP
        "swap_ra",
@@ -1497,6 +1495,10 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
        if (is_zone_first_populated(pgdat, zone)) {
                seq_printf(m, "\n  per-node stats");
                for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) {
+                       /* Skip hidden vmstat items. */
+                       if (*vmstat_text[i + NR_VM_ZONE_STAT_ITEMS +
+                                        NR_VM_NUMA_STAT_ITEMS] == '\0')
+                               continue;
                        seq_printf(m, "\n      %-12s %lu",
                                vmstat_text[i + NR_VM_ZONE_STAT_ITEMS +
                                NR_VM_NUMA_STAT_ITEMS],
@@ -1670,6 +1672,10 @@ static int vmstat_show(struct seq_file *m, void *arg)
        unsigned long *l = arg;
        unsigned long off = l - (unsigned long *)m->private;
 
+       /* Skip hidden vmstat items. */
+       if (*vmstat_text[off] == '\0')
+               return 0;
+
        seq_puts(m, vmstat_text[off]);
        seq_put_decimal_ull(m, " ", *l);
        seq_putc(m, '\n');
@@ -1799,12 +1805,13 @@ static bool need_update(int cpu)
 
                /*
                 * The fast way of checking if there are any vmstat diffs.
-                * This works because the diffs are byte sized items.
                 */
-               if (memchr_inv(p->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS))
+               if (memchr_inv(p->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS *
+                              sizeof(p->vm_stat_diff[0])))
                        return true;
 #ifdef CONFIG_NUMA
-               if (memchr_inv(p->vm_numa_stat_diff, 0, NR_VM_NUMA_STAT_ITEMS))
+               if (memchr_inv(p->vm_numa_stat_diff, 0, NR_VM_NUMA_STAT_ITEMS *
+                              sizeof(p->vm_numa_stat_diff[0])))
                        return true;
 #endif
        }
@@ -1945,7 +1952,7 @@ void __init init_mm_internals(void)
 #endif
 #ifdef CONFIG_PROC_FS
        proc_create("buddyinfo", 0444, NULL, &buddyinfo_file_operations);
-       proc_create("pagetypeinfo", 0444, NULL, &pagetypeinfo_file_operations);
+       proc_create("pagetypeinfo", 0400, NULL, &pagetypeinfo_file_operations);
        proc_create("vmstat", 0444, NULL, &vmstat_file_operations);
        proc_create("zoneinfo", 0444, NULL, &zoneinfo_file_operations);
 #endif