Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
"14 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
kernel/sysctl.c: fix out-of-bounds access when setting file-max
mm/util.c: fix strndup_user() comment
sh: fix multiple function definition build errors
MAINTAINERS: add maintainer and replacing reviewer ARM/NUVOTON NPCM
MAINTAINERS: fix bad pattern in ARM/NUVOTON NPCM
mm: writeback: use exact memcg dirty counts
psi: clarify the units used in pressure files
mm/huge_memory.c: fix modifying of page protection by insert_pfn_pmd()
hugetlbfs: fix memory leak for resv_map
mm: fix vm_fault_t cast in VM_FAULT_GET_HINDEX()
lib/lzo: fix bugs for very short or empty input
include/linux/bitrev.h: fix constant bitrev
kmemleak: powerpc: skip scanning holes in the .bss section
lib/string.c: implement a basic bcmp

+163 -59
+6 -6
Documentation/accounting/psi.txt
··· 56 56 still doing productive work. As such, time spent in this subset of the 57 57 stall state is tracked separately and exported in the "full" averages. 58 58 59 - The ratios are tracked as recent trends over ten, sixty, and three 60 - hundred second windows, which gives insight into short term events as 61 - well as medium and long term trends. The total absolute stall time is 62 - tracked and exported as well, to allow detection of latency spikes 63 - which wouldn't necessarily make a dent in the time averages, or to 64 - average trends over custom time frames. 59 + The ratios (in %) are tracked as recent trends over ten, sixty, and 60 + three hundred second windows, which gives insight into short term events 61 + as well as medium and long term trends. The total absolute stall time 62 + (in us) is tracked and exported as well, to allow detection of latency 63 + spikes which wouldn't necessarily make a dent in the time averages, 64 + or to average trends over custom time frames. 65 65 66 66 Cgroup2 interface 67 67 =================
+5 -3
Documentation/lzo.txt
··· 102 102 dictionary which is empty, and that it will always be 103 103 invalid at this place. 104 104 105 - 17 : bitstream version. If the first byte is 17, the next byte 106 - gives the bitstream version (version 1 only). If the first byte 107 - is not 17, the bitstream version is 0. 105 + 17 : bitstream version. If the first byte is 17, and compressed 106 + stream length is at least 5 bytes (length of shortest possible 107 + versioned bitstream), the next byte gives the bitstream version 108 + (version 1 only). 109 + Otherwise, the bitstream version is 0. 108 110 109 111 18..21 : copy 0..3 literals 110 112 state = (byte - 17) = 0..3 [ copy <state> literals ]
+3 -2
MAINTAINERS
··· 1893 1893 ARM/NUVOTON NPCM ARCHITECTURE 1894 1894 M: Avi Fishman <avifishman70@gmail.com> 1895 1895 M: Tomer Maimon <tmaimon77@gmail.com> 1896 + M: Tali Perry <tali.perry1@gmail.com> 1896 1897 R: Patrick Venture <venture@google.com> 1897 1898 R: Nancy Yuen <yuenn@google.com> 1898 - R: Brendan Higgins <brendanhiggins@google.com> 1899 + R: Benjamin Fair <benjaminfair@google.com> 1899 1900 L: openbmc@lists.ozlabs.org (moderated for non-subscribers) 1900 1901 S: Supported 1901 1902 F: arch/arm/mach-npcm/ 1902 1903 F: arch/arm/boot/dts/nuvoton-npcm* 1903 - F: include/dt-bindings/clock/nuvoton,npcm7xx-clks.h 1904 + F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h 1904 1905 F: drivers/*/*npcm* 1905 1906 F: Documentation/devicetree/bindings/*/*npcm* 1906 1907 F: Documentation/devicetree/bindings/*/*/*npcm*
+7
arch/powerpc/kernel/kvm.c
··· 22 22 #include <linux/kvm_host.h> 23 23 #include <linux/init.h> 24 24 #include <linux/export.h> 25 + #include <linux/kmemleak.h> 25 26 #include <linux/kvm_para.h> 26 27 #include <linux/slab.h> 27 28 #include <linux/of.h> ··· 713 712 714 713 static __init void kvm_free_tmp(void) 715 714 { 715 + /* 716 + * Inform kmemleak about the hole in the .bss section since the 717 + * corresponding pages will be unmapped with DEBUG_PAGEALLOC=y. 718 + */ 719 + kmemleak_free_part(&kvm_tmp[kvm_tmp_index], 720 + ARRAY_SIZE(kvm_tmp) - kvm_tmp_index); 716 721 free_reserved_area(&kvm_tmp[kvm_tmp_index], 717 722 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL); 718 723 }
+2 -2
arch/sh/boards/of-generic.c
··· 164 164 165 165 struct sh_clk_ops; 166 166 167 - void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 167 + void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 168 168 { 169 169 } 170 170 171 - void __init plat_irq_setup(void) 171 + void __init __weak plat_irq_setup(void) 172 172 { 173 173 }
+14 -6
fs/hugetlbfs/inode.c
··· 755 755 umode_t mode, dev_t dev) 756 756 { 757 757 struct inode *inode; 758 - struct resv_map *resv_map; 758 + struct resv_map *resv_map = NULL; 759 759 760 - resv_map = resv_map_alloc(); 761 - if (!resv_map) 762 - return NULL; 760 + /* 761 + * Reserve maps are only needed for inodes that can have associated 762 + * page allocations. 763 + */ 764 + if (S_ISREG(mode) || S_ISLNK(mode)) { 765 + resv_map = resv_map_alloc(); 766 + if (!resv_map) 767 + return NULL; 768 + } 763 769 764 770 inode = new_inode(sb); 765 771 if (inode) { ··· 800 794 break; 801 795 } 802 796 lockdep_annotate_inode_mutex_key(inode); 803 - } else 804 - kref_put(&resv_map->refs, resv_map_release); 797 + } else { 798 + if (resv_map) 799 + kref_put(&resv_map->refs, resv_map_release); 800 + } 805 801 806 802 return inode; 807 803 }
+23 -23
include/linux/bitrev.h
··· 34 34 35 35 #define __constant_bitrev32(x) \ 36 36 ({ \ 37 - u32 __x = x; \ 38 - __x = (__x >> 16) | (__x << 16); \ 39 - __x = ((__x & (u32)0xFF00FF00UL) >> 8) | ((__x & (u32)0x00FF00FFUL) << 8); \ 40 - __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \ 41 - __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \ 42 - __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \ 43 - __x; \ 37 + u32 ___x = x; \ 38 + ___x = (___x >> 16) | (___x << 16); \ 39 + ___x = ((___x & (u32)0xFF00FF00UL) >> 8) | ((___x & (u32)0x00FF00FFUL) << 8); \ 40 + ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \ 41 + ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \ 42 + ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \ 43 + ___x; \ 44 44 }) 45 45 46 46 #define __constant_bitrev16(x) \ 47 47 ({ \ 48 - u16 __x = x; \ 49 - __x = (__x >> 8) | (__x << 8); \ 50 - __x = ((__x & (u16)0xF0F0U) >> 4) | ((__x & (u16)0x0F0FU) << 4); \ 51 - __x = ((__x & (u16)0xCCCCU) >> 2) | ((__x & (u16)0x3333U) << 2); \ 52 - __x = ((__x & (u16)0xAAAAU) >> 1) | ((__x & (u16)0x5555U) << 1); \ 53 - __x; \ 48 + u16 ___x = x; \ 49 + ___x = (___x >> 8) | (___x << 8); \ 50 + ___x = ((___x & (u16)0xF0F0U) >> 4) | ((___x & (u16)0x0F0FU) << 4); \ 51 + ___x = ((___x & (u16)0xCCCCU) >> 2) | ((___x & (u16)0x3333U) << 2); \ 52 + ___x = ((___x & (u16)0xAAAAU) >> 1) | ((___x & (u16)0x5555U) << 1); \ 53 + ___x; \ 54 54 }) 55 55 56 56 #define __constant_bitrev8x4(x) \ 57 57 ({ \ 58 - u32 __x = x; \ 59 - __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \ 60 - __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \ 61 - __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \ 62 - __x; \ 58 + u32 ___x = x; \ 59 + ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \ 60 + ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \ 61 + ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \ 62 + ___x; \ 63 63 }) 64 64 65 65 #define __constant_bitrev8(x) \ 66 66 ({ \ 67 - u8 __x = x; \ 68 - __x = (__x >> 4) | (__x << 4); \ 69 - __x = ((__x & (u8)0xCCU) >> 2) | ((__x & (u8)0x33U) << 2); \ 70 - __x = ((__x & (u8)0xAAU) >> 1) | ((__x & (u8)0x55U) << 1); \ 71 - __x; \ 67 + u8 ___x = x; \ 68 + ___x = (___x >> 4) | (___x << 4); \ 69 + ___x = ((___x & (u8)0xCCU) >> 2) | ((___x & (u8)0x33U) << 2); \ 70 + ___x = ((___x & (u8)0xAAU) >> 1) | ((___x & (u8)0x55U) << 1); \ 71 + ___x; \ 72 72 }) 73 73 74 74 #define bitrev32(x) \
+4 -1
include/linux/memcontrol.h
··· 566 566 void __unlock_page_memcg(struct mem_cgroup *memcg); 567 567 void unlock_page_memcg(struct page *page); 568 568 569 - /* idx can be of type enum memcg_stat_item or node_stat_item */ 569 + /* 570 + * idx can be of type enum memcg_stat_item or node_stat_item. 571 + * Keep in sync with memcg_exact_page_state(). 572 + */ 570 573 static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, 571 574 int idx) 572 575 {
+1 -1
include/linux/mm_types.h
··· 671 671 672 672 /* Encode hstate index for a hwpoisoned large page */ 673 673 #define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16)) 674 - #define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf) 674 + #define VM_FAULT_GET_HINDEX(x) (((__force unsigned int)(x) >> 16) & 0xf) 675 675 676 676 #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \ 677 677 VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \
+3
include/linux/string.h
··· 150 150 #ifndef __HAVE_ARCH_MEMCMP 151 151 extern int memcmp(const void *,const void *,__kernel_size_t); 152 152 #endif 153 + #ifndef __HAVE_ARCH_BCMP 154 + extern int bcmp(const void *,const void *,__kernel_size_t); 155 + #endif 153 156 #ifndef __HAVE_ARCH_MEMCHR 154 157 extern void * memchr(const void *,int,__kernel_size_t); 155 158 #endif
+2 -1
kernel/sysctl.c
··· 128 128 static int __maybe_unused one = 1; 129 129 static int __maybe_unused two = 2; 130 130 static int __maybe_unused four = 4; 131 + static unsigned long zero_ul; 131 132 static unsigned long one_ul = 1; 132 133 static unsigned long long_max = LONG_MAX; 133 134 static int one_hundred = 100; ··· 1751 1750 .maxlen = sizeof(files_stat.max_files), 1752 1751 .mode = 0644, 1753 1752 .proc_handler = proc_doulongvec_minmax, 1754 - .extra1 = &zero, 1753 + .extra1 = &zero_ul, 1755 1754 .extra2 = &long_max, 1756 1755 }, 1757 1756 {
+6 -3
lib/lzo/lzo1x_compress.c
··· 291 291 { 292 292 const unsigned char *ip = in; 293 293 unsigned char *op = out; 294 + unsigned char *data_start; 294 295 size_t l = in_len; 295 296 size_t t = 0; 296 297 signed char state_offset = -2; 297 298 unsigned int m4_max_offset; 298 299 299 - // LZO v0 will never write 17 as first byte, 300 - // so this is used to version the bitstream 300 + // LZO v0 will never write 17 as first byte (except for zero-length 301 + // input), so this is used to version the bitstream 301 302 if (bitstream_version > 0) { 302 303 *op++ = 17; 303 304 *op++ = bitstream_version; ··· 306 305 } else { 307 306 m4_max_offset = M4_MAX_OFFSET_V0; 308 307 } 308 + 309 + data_start = op; 309 310 310 311 while (l > 20) { 311 312 size_t ll = l <= (m4_max_offset + 1) ? l : (m4_max_offset + 1); ··· 327 324 if (t > 0) { 328 325 const unsigned char *ii = in + in_len - t; 329 326 330 - if (op == out && t <= 238) { 327 + if (op == data_start && t <= 238) { 331 328 *op++ = (17 + t); 332 329 } else if (t <= 3) { 333 330 op[state_offset] |= t;
+1 -3
lib/lzo/lzo1x_decompress_safe.c
··· 54 54 if (unlikely(in_len < 3)) 55 55 goto input_overrun; 56 56 57 - if (likely(*ip == 17)) { 57 + if (likely(in_len >= 5) && likely(*ip == 17)) { 58 58 bitstream_version = ip[1]; 59 59 ip += 2; 60 - if (unlikely(in_len < 5)) 61 - goto input_overrun; 62 60 } else { 63 61 bitstream_version = 0; 64 62 }
+20
lib/string.c
··· 866 866 EXPORT_SYMBOL(memcmp); 867 867 #endif 868 868 869 + #ifndef __HAVE_ARCH_BCMP 870 + /** 871 + * bcmp - returns 0 if and only if the buffers have identical contents. 872 + * @a: pointer to first buffer. 873 + * @b: pointer to second buffer. 874 + * @len: size of buffers. 875 + * 876 + * The sign or magnitude of a non-zero return value has no particular 877 + * meaning, and architectures may implement their own more efficient bcmp(). So 878 + * while this particular implementation is a simple (tail) call to memcmp, do 879 + * not rely on anything but whether the return value is zero or non-zero. 880 + */ 881 + #undef bcmp 882 + int bcmp(const void *a, const void *b, size_t len) 883 + { 884 + return memcmp(a, b, len); 885 + } 886 + EXPORT_SYMBOL(bcmp); 887 + #endif 888 + 869 889 #ifndef __HAVE_ARCH_MEMSCAN 870 890 /** 871 891 * memscan - Find a character in an area of memory.
+36
mm/huge_memory.c
··· 755 755 spinlock_t *ptl; 756 756 757 757 ptl = pmd_lock(mm, pmd); 758 + if (!pmd_none(*pmd)) { 759 + if (write) { 760 + if (pmd_pfn(*pmd) != pfn_t_to_pfn(pfn)) { 761 + WARN_ON_ONCE(!is_huge_zero_pmd(*pmd)); 762 + goto out_unlock; 763 + } 764 + entry = pmd_mkyoung(*pmd); 765 + entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); 766 + if (pmdp_set_access_flags(vma, addr, pmd, entry, 1)) 767 + update_mmu_cache_pmd(vma, addr, pmd); 768 + } 769 + 770 + goto out_unlock; 771 + } 772 + 758 773 entry = pmd_mkhuge(pfn_t_pmd(pfn, prot)); 759 774 if (pfn_t_devmap(pfn)) 760 775 entry = pmd_mkdevmap(entry); ··· 781 766 if (pgtable) { 782 767 pgtable_trans_huge_deposit(mm, pmd, pgtable); 783 768 mm_inc_nr_ptes(mm); 769 + pgtable = NULL; 784 770 } 785 771 786 772 set_pmd_at(mm, addr, pmd, entry); 787 773 update_mmu_cache_pmd(vma, addr, pmd); 774 + 775 + out_unlock: 788 776 spin_unlock(ptl); 777 + if (pgtable) 778 + pte_free(mm, pgtable); 789 779 } 790 780 791 781 vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, ··· 841 821 spinlock_t *ptl; 842 822 843 823 ptl = pud_lock(mm, pud); 824 + if (!pud_none(*pud)) { 825 + if (write) { 826 + if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) { 827 + WARN_ON_ONCE(!is_huge_zero_pud(*pud)); 828 + goto out_unlock; 829 + } 830 + entry = pud_mkyoung(*pud); 831 + entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma); 832 + if (pudp_set_access_flags(vma, addr, pud, entry, 1)) 833 + update_mmu_cache_pud(vma, addr, pud); 834 + } 835 + goto out_unlock; 836 + } 837 + 844 838 entry = pud_mkhuge(pfn_t_pud(pfn, prot)); 845 839 if (pfn_t_devmap(pfn)) 846 840 entry = pud_mkdevmap(entry); ··· 864 830 } 865 831 set_pud_at(mm, addr, pud, entry); 866 832 update_mmu_cache_pud(vma, addr, pud); 833 + 834 + out_unlock: 867 835 spin_unlock(ptl); 868 836 } 869 837
+11 -5
mm/kmemleak.c
··· 1529 1529 } 1530 1530 rcu_read_unlock(); 1531 1531 1532 - /* data/bss scanning */ 1533 - scan_large_block(_sdata, _edata); 1534 - scan_large_block(__bss_start, __bss_stop); 1535 - scan_large_block(__start_ro_after_init, __end_ro_after_init); 1536 - 1537 1532 #ifdef CONFIG_SMP 1538 1533 /* per-cpu sections scanning */ 1539 1534 for_each_possible_cpu(i) ··· 2065 2070 kmemleak_free_enabled = 1; 2066 2071 } 2067 2072 local_irq_restore(flags); 2073 + 2074 + /* register the data/bss sections */ 2075 + create_object((unsigned long)_sdata, _edata - _sdata, 2076 + KMEMLEAK_GREY, GFP_ATOMIC); 2077 + create_object((unsigned long)__bss_start, __bss_stop - __bss_start, 2078 + KMEMLEAK_GREY, GFP_ATOMIC); 2079 + /* only register .data..ro_after_init if not within .data */ 2080 + if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata) 2081 + create_object((unsigned long)__start_ro_after_init, 2082 + __end_ro_after_init - __start_ro_after_init, 2083 + KMEMLEAK_GREY, GFP_ATOMIC); 2068 2084 2069 2085 /* 2070 2086 * This is the point where tracking allocations is safe. Automatic
+18 -2
mm/memcontrol.c
··· 3882 3882 return &memcg->cgwb_domain; 3883 3883 } 3884 3884 3885 + /* 3886 + * idx can be of type enum memcg_stat_item or node_stat_item. 3887 + * Keep in sync with memcg_exact_page(). 3888 + */ 3889 + static unsigned long memcg_exact_page_state(struct mem_cgroup *memcg, int idx) 3890 + { 3891 + long x = atomic_long_read(&memcg->stat[idx]); 3892 + int cpu; 3893 + 3894 + for_each_online_cpu(cpu) 3895 + x += per_cpu_ptr(memcg->stat_cpu, cpu)->count[idx]; 3896 + if (x < 0) 3897 + x = 0; 3898 + return x; 3899 + } 3900 + 3885 3901 /** 3886 3902 * mem_cgroup_wb_stats - retrieve writeback related stats from its memcg 3887 3903 * @wb: bdi_writeback in question ··· 3923 3907 struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css); 3924 3908 struct mem_cgroup *parent; 3925 3909 3926 - *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY); 3910 + *pdirty = memcg_exact_page_state(memcg, NR_FILE_DIRTY); 3927 3911 3928 3912 /* this should eventually include NR_UNSTABLE_NFS */ 3929 - *pwriteback = memcg_page_state(memcg, NR_WRITEBACK); 3913 + *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK); 3930 3914 *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) | 3931 3915 (1 << LRU_ACTIVE_FILE)); 3932 3916 *pheadroom = PAGE_COUNTER_MAX;
+1 -1
mm/util.c
··· 204 204 * @s: The string to duplicate 205 205 * @n: Maximum number of bytes to copy, including the trailing NUL. 206 206 * 207 - * Return: newly allocated copy of @s or %NULL in case of error 207 + * Return: newly allocated copy of @s or an ERR_PTR() in case of error 208 208 */ 209 209 char *strndup_user(const char __user *s, long n) 210 210 {