Merge branch 'akpm' (patches from Andrew)
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Mar 2019 03:25:37 +0000 (19:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Mar 2019 03:25:37 +0000 (19:25 -0800)
Merge more updates from Andrew Morton:

 - some of the rest of MM

 - various misc things

 - dynamic-debug updates

 - checkpatch

 - some epoll speedups

 - autofs

 - rapidio

 - lib/, lib/lzo/ updates

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (83 commits)
  samples/mic/mpssd/mpssd.h: remove duplicate header
  kernel/fork.c: remove duplicated include
  include/linux/relay.h: fix percpu annotation in struct rchan
  arch/nios2/mm/fault.c: remove duplicate include
  unicore32: stop printing the virtual memory layout
  MAINTAINERS: fix GTA02 entry and mark as orphan
  mm: create the new vm_fault_t type
  arm, s390, unicore32: remove oneliner wrappers for memblock_alloc()
  arch: simplify several early memory allocations
  openrisc: simplify pte_alloc_one_kernel()
  sh: prefer memblock APIs returning virtual address
  microblaze: prefer memblock API returning virtual address
  powerpc: prefer memblock APIs returning virtual address
  lib/lzo: separate lzo-rle from lzo
  lib/lzo: implement run-length encoding
  lib/lzo: fast 8-byte copy on arm64
  lib/lzo: 64-bit CTZ on arm64
  lib/lzo: tidy-up ifdefs
  ipc/sem.c: replace kvmalloc/memset with kvzalloc and use struct_size
  ipc: annotate implicit fall through
  ...

148 files changed:
Documentation/dontdiff
Documentation/lzo.txt
Documentation/process/4.Coding.rst
Documentation/translations/it_IT/process/4.Coding.rst
MAINTAINERS
arch/arc/configs/axs101_defconfig
arch/arc/configs/axs103_defconfig
arch/arc/configs/axs103_smp_defconfig
arch/arc/configs/haps_hs_defconfig
arch/arc/configs/haps_hs_smp_defconfig
arch/arc/configs/hsdk_defconfig
arch/arc/configs/nps_defconfig
arch/arc/configs/nsim_700_defconfig
arch/arc/configs/nsim_hs_defconfig
arch/arc/configs/nsim_hs_smp_defconfig
arch/arc/configs/nsimosci_defconfig
arch/arc/configs/nsimosci_hs_defconfig
arch/arc/configs/nsimosci_hs_smp_defconfig
arch/arc/configs/tb10x_defconfig
arch/arc/configs/vdk_hs38_defconfig
arch/arc/configs/vdk_hs38_smp_defconfig
arch/arm/configs/bcm2835_defconfig
arch/arm/configs/cns3420vb_defconfig
arch/arm/configs/efm32_defconfig
arch/arm/configs/eseries_pxa_defconfig
arch/arm/configs/gemini_defconfig
arch/arm/configs/mini2440_defconfig
arch/arm/configs/moxart_defconfig
arch/arm/configs/mps2_defconfig
arch/arm/configs/nuc910_defconfig
arch/arm/configs/nuc950_defconfig
arch/arm/configs/nuc960_defconfig
arch/arm/configs/stm32_defconfig
arch/arm/mm/mmu.c
arch/c6x/mm/dma-coherent.c
arch/h8300/configs/edosk2674_defconfig
arch/h8300/configs/h8300h-sim_defconfig
arch/h8300/configs/h8s-sim_defconfig
arch/m68k/configs/amcore_defconfig
arch/m68k/configs/stmark2_defconfig
arch/microblaze/mm/init.c
arch/nds32/mm/init.c
arch/nios2/configs/10m50_defconfig
arch/nios2/configs/3c120_defconfig
arch/nios2/mm/fault.c
arch/openrisc/configs/or1ksim_defconfig
arch/openrisc/configs/simple_smp_defconfig
arch/openrisc/mm/ioremap.c
arch/powerpc/configs/mpc512x_defconfig
arch/powerpc/configs/ppc6xx_defconfig
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/pgtable-book3e.c
arch/powerpc/mm/pgtable-book3s64.c
arch/powerpc/mm/pgtable-radix.c
arch/powerpc/mm/ppc_mmu_32.c
arch/powerpc/platforms/pasemi/iommu.c
arch/powerpc/platforms/powernv/opal.c
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/sysdev/dart_iommu.c
arch/s390/numa/numa.c
arch/sh/configs/apsh4a3a_defconfig
arch/sh/configs/edosk7705_defconfig
arch/sh/configs/espt_defconfig
arch/sh/configs/sdk7786_defconfig
arch/sh/configs/sh2007_defconfig
arch/sh/configs/sh7724_generic_defconfig
arch/sh/configs/sh7763rdp_defconfig
arch/sh/configs/sh7770_generic_defconfig
arch/sh/configs/sh7785lcr_defconfig
arch/sh/configs/ul2_defconfig
arch/sh/configs/urquell_defconfig
arch/sh/mm/init.c
arch/sh/mm/numa.c
arch/sparc/configs/sparc32_defconfig
arch/sparc/configs/sparc64_defconfig
arch/sparc/kernel/prom_64.c
arch/sparc/mm/init_64.c
arch/unicore32/mm/init.c
arch/unicore32/mm/mmu.c
arch/x86/configs/i386_defconfig
arch/x86/configs/x86_64_defconfig
arch/x86/mm/fault.c
crypto/Makefile
crypto/lzo-rle.c [new file with mode: 0644]
crypto/tcrypt.c
drivers/block/zram/zcomp.c
drivers/rapidio/devices/rio_mport_cdev.c
drivers/rapidio/rio_cm.c
fs/autofs/autofs_i.h
fs/autofs/inode.c
fs/binfmt_elf.c
fs/btrfs/ctree.h
fs/eventpoll.c
fs/exec.c
fs/fat/file.c
fs/namei.c
include/linux/acpi.h
include/linux/bitops.h
include/linux/build_bug.h
include/linux/delay.h
include/linux/device.h
include/linux/dynamic_debug.h
include/linux/fs.h
include/linux/kernel.h
include/linux/limits.h [new file with mode: 0644]
include/linux/lzo.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/net.h
include/linux/pid.h
include/linux/printk.h
include/linux/relay.h
include/linux/types.h
include/uapi/linux/auto_fs.h
include/uapi/linux/binfmts.h
include/uapi/linux/limits.h
init/initramfs.c
ipc/sem.c
kernel/.gitignore
kernel/Makefile
kernel/configs.c
kernel/fork.c
kernel/gcov/gcc_3_4.c
kernel/hung_task.c
kernel/kcov.c
kernel/module.c
kernel/panic.c
kernel/sys.c
kernel/sysctl.c
kernel/workqueue.c
lib/Kconfig.ubsan
lib/assoc_array.c
lib/div64.c
lib/dynamic_debug.c
lib/lzo/lzo1x_compress.c
lib/lzo/lzo1x_decompress_safe.c
lib/lzo/lzodefs.h
lib/test_firmware.c
lib/test_ubsan.c
lib/vsprintf.c
samples/mic/mpssd/mpssd.h
scripts/checkpatch.pl
scripts/gdb/linux/constants.py.in
scripts/gdb/linux/proc.py
scripts/spelling.txt

index 2228fcc..ef25a06 100644 (file)
@@ -106,7 +106,6 @@ compile.h*
 conf
 config
 config-*
-config_data.h*
 config.mak
 config.mak.autogen
 conmakehash
index 6fa6a93..f799342 100644 (file)
@@ -78,16 +78,34 @@ Description
      is an implementation design choice independent on the algorithm or
      encoding.
 
+Versions
+
+0: Original version
+1: LZO-RLE
+
+Version 1 of LZO implements an extension to encode runs of zeros using run
+length encoding. This improves speed for data with many zeros, which is a
+common case for zram. This modifies the bitstream in a backwards compatible way
+(v1 can correctly decompress v0 compressed data, but v0 cannot read v1 data).
+
+For maximum compatibility, both versions are available under different names
+(lzo and lzo-rle). Differences in the encoding are noted in this document with
+e.g.: version 1 only.
+
 Byte sequences
 ==============
 
   First byte encoding::
 
-      0..17   : follow regular instruction encoding, see below. It is worth
-                noting that codes 16 and 17 will represent a block copy from
-                the dictionary which is empty, and that they will always be
+      0..16   : follow regular instruction encoding, see below. It is worth
+                noting that code 16 will represent a block copy from the
+                dictionary which is empty, and that it will always be
                 invalid at this place.
 
+      17      : bitstream version. If the first byte is 17, the next byte
+                gives the bitstream version (version 1 only). If the first byte
+                is not 17, the bitstream version is 0.
+
       18..21  : copy 0..3 literals
                 state = (byte - 17) = 0..3  [ copy <state> literals ]
                 skip byte
@@ -140,6 +158,11 @@ Byte sequences
            state = S (copy S literals after this block)
            End of stream is reached if distance == 16384
 
+        In version 1 only, this instruction is also used to encode a run of
+        zeros if distance = 0xbfff, i.e. H = 1 and the D bits are all 1.
+           In this case, it is followed by a fourth byte, X.
+           run length = ((X << 3) | (0 0 0 0 0 L L L)) + 4.
+
       0 0 1 L L L L L  (32..63)
            Copy of small block within 16kB distance (preferably less than 34B)
            length = 2 + (L ?: 31 + (zero_bytes * 255) + non_zero_byte)
@@ -165,7 +188,9 @@ Authors
 =======
 
   This document was written by Willy Tarreau <w@1wt.eu> on 2014/07/19 during an
-  analysis of the decompression code available in Linux 3.16-rc5. The code is
-  tricky, it is possible that this document contains mistakes or that a few
-  corner cases were overlooked. In any case, please report any doubt, fix, or
-  proposed updates to the author(s) so that the document can be updated.
+  analysis of the decompression code available in Linux 3.16-rc5, and updated
+  by Dave Rodgman <dave.rodgman@arm.com> on 2018/10/30 to introduce run-length
+  encoding. The code is tricky, it is possible that this document contains
+  mistakes or that a few corner cases were overlooked. In any case, please
+  report any doubt, fix, or proposed updates to the author(s) so that the
+  document can be updated.
index cfe2648..4b7a5ab 100644 (file)
@@ -249,7 +249,7 @@ features; most of these are found in the "kernel hacking" submenu.  Several
 of these options should be turned on for any kernel used for development or
 testing purposes.  In particular, you should turn on:
 
- - ENABLE_WARN_DEPRECATED, ENABLE_MUST_CHECK, and FRAME_WARN to get an
+ - ENABLE_MUST_CHECK and FRAME_WARN to get an
    extra set of warnings for problems like the use of deprecated interfaces
    or ignoring an important return value from a function.  The output
    generated by these warnings can be verbose, but one need not worry about
index c610590..c05b89e 100644 (file)
@@ -264,7 +264,7 @@ La maggior parte di queste opzioni possono essere attivate per qualsiasi
 kernel utilizzato per lo sviluppo o a scopo di test.  In particolare dovreste
 attivare:
 
- - ENABLE_WARN_DEPRECATED, ENABLE_MUST_CHECK, e FRAME_WARN per ottenere degli
+ - ENABLE_MUST_CHECK e FRAME_WARN per ottenere degli
    avvertimenti dedicati a problemi come l'uso di interfacce deprecate o
    l'ignorare un importante valore di ritorno di una funzione.  Il risultato
    generato da questi avvertimenti può risultare verboso, ma non bisogna
index 09d47cd..fce33cc 100644 (file)
@@ -1899,10 +1899,11 @@ F:      drivers/usb/host/ehci-w90x900.c
 F:     drivers/video/fbdev/nuc900fb.c
 
 ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT
-M:     Nelson Castillo <arhuaco@freaks-unidos.net>
 L:     openmoko-kernel@lists.openmoko.org (subscribers-only)
 W:     http://wiki.openmoko.org/wiki/Neo_FreeRunner
-S:     Supported
+S:     Orphan
+F:     arch/arm/mach-s3c24xx/mach-gta02.c
+F:     arch/arm/mach-s3c24xx/gta02.h
 
 ARM/Orion SoC/Technologic Systems TS-78xx platform support
 M:     Alexander Clouter <alex@digriz.org.uk>
index 020d449..e31a8eb 100644 (file)
@@ -99,7 +99,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_SOFTLOCKUP_DETECTOR=y
index 666314f..e0e8567 100644 (file)
@@ -97,7 +97,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_SOFTLOCKUP_DETECTOR=y
index 429832b..fcbc952 100644 (file)
@@ -100,7 +100,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_SOFTLOCKUP_DETECTOR=y
index 240dd2c..f56cc20 100644 (file)
@@ -75,7 +75,6 @@ CONFIG_EXT2_FS_XATTR=y
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_MEMORY_INIT=y
 # CONFIG_DEBUG_PREEMPT is not set
index 14ae7e5..b6f2482 100644 (file)
@@ -78,7 +78,6 @@ CONFIG_EXT2_FS_XATTR=y
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_SOFTLOCKUP_DETECTOR=y
 # CONFIG_DEBUG_PREEMPT is not set
index 87b23b7..6fd3d29 100644 (file)
@@ -71,7 +71,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_SOFTLOCKUP_DETECTOR=y
index 621f594..f0a077c 100644 (file)
@@ -76,7 +76,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_ROOT_NFS=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_MEMORY_INIT=y
index 219c2a6..318e4cd 100644 (file)
@@ -56,6 +56,5 @@ CONFIG_EXT2_FS_XATTR=y
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_DEBUG_PREEMPT is not set
index 739b90e..c15807b 100644 (file)
@@ -56,6 +56,5 @@ CONFIG_EXT2_FS_XATTR=y
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_DEBUG_PREEMPT is not set
index b5895bd..65e983f 100644 (file)
@@ -55,5 +55,4 @@ CONFIG_EXT2_FS_XATTR=y
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index 35dfc64..08c5b99 100644 (file)
@@ -68,5 +68,4 @@ CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index 1638e5b..5b5e26d 100644 (file)
@@ -66,5 +66,4 @@ CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index 11cfbdb..26af9b2 100644 (file)
@@ -77,6 +77,5 @@ CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_FTRACE=y
index e71ade3..5b5119d 100644 (file)
@@ -92,7 +92,6 @@ CONFIG_CONFIGFS_FS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 # CONFIG_NETWORK_FILESYSTEMS is not set
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_DEBUG_FS=y
 CONFIG_HEADERS_CHECK=y
index e447ace..0c3b214 100644 (file)
@@ -87,7 +87,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_DEBUG_SHIRQ=y
index c82cdb1..f9ad9d3 100644 (file)
@@ -91,7 +91,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_DEBUG_SHIRQ=y
index bd55a2b..dcf7610 100644 (file)
@@ -161,7 +161,6 @@ CONFIG_PRINTK_TIME=y
 CONFIG_BOOT_PRINTK_DELAY=y
 CONFIG_DYNAMIC_DEBUG=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_UNUSED_SYMBOLS=y
 CONFIG_DEBUG_MEMORY_INIT=y
index c6dcd6e..419b735 100644 (file)
@@ -60,7 +60,6 @@ CONFIG_EXT2_FS_XATTR=y
 CONFIG_AUTOFS4_FS=y
 CONFIG_FSCACHE=y
 CONFIG_TMPFS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_ARM_UNWIND is not set
index 860d271..ee42158 100644 (file)
@@ -94,7 +94,6 @@ CONFIG_ROMFS_BACKED_BY_MTD=y
 # CONFIG_NETWORK_FILESYSTEMS is not set
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_SCHED_DEBUG is not set
index cd27d65..eabb784 100644 (file)
@@ -103,7 +103,6 @@ CONFIG_NFS_V3=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_CRYPTO_CBC=m
 CONFIG_CRYPTO_PCBC=m
index 553777a..ef9aae8 100644 (file)
@@ -87,6 +87,5 @@ CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_ROMFS_FS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
index 88ea02e..d95a805 100644 (file)
@@ -298,7 +298,6 @@ CONFIG_NLS_KOI8_R=m
 CONFIG_NLS_KOI8_U=m
 CONFIG_NLS_UTF8=m
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_DEBUG_FS=y
index 2da0d9e..078228a 100644 (file)
@@ -125,7 +125,6 @@ CONFIG_CONFIGFS_FS=y
 CONFIG_JFFS2_FS=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_PAGEALLOC=y
 CONFIG_DEBUG_OBJECTS=y
index 0bcdec7..1d923db 100644 (file)
@@ -100,7 +100,6 @@ CONFIG_ROOT_NFS=y
 CONFIG_NLS=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_SCHED_DEBUG is not set
index a726536..c0d152c 100644 (file)
@@ -47,7 +47,6 @@ CONFIG_ROMFS_FS=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_CRC32 is not set
index 614a0a2..8dde118 100644 (file)
@@ -64,6 +64,5 @@ CONFIG_ROMFS_FS=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
index b84bbd2..6bb784f 100644 (file)
@@ -53,7 +53,6 @@ CONFIG_ROMFS_FS=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_CRC32 is not set
index ba805b7..0258ba8 100644 (file)
@@ -80,7 +80,6 @@ CONFIG_EXT3_FS=y
 CONFIG_NLS=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_SCHED_DEBUG is not set
index f5cc1cc..57de0dd 100644 (file)
@@ -719,16 +719,9 @@ EXPORT_SYMBOL(phys_mem_access_prot);
 
 #define vectors_base() (vectors_high() ? 0xffff0000 : 0)
 
-static void __init *early_alloc_aligned(unsigned long sz, unsigned long align)
-{
-       void *ptr = __va(memblock_phys_alloc(sz, align));
-       memset(ptr, 0, sz);
-       return ptr;
-}
-
 static void __init *early_alloc(unsigned long sz)
 {
-       return early_alloc_aligned(sz, sz);
+       return memblock_alloc(sz, sz);
 }
 
 static void *__init late_alloc(unsigned long sz)
@@ -1000,7 +993,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
        if (!nr)
                return;
 
-       svm = early_alloc_aligned(sizeof(*svm) * nr, __alignof__(*svm));
+       svm = memblock_alloc(sizeof(*svm) * nr, __alignof__(*svm));
 
        for (md = io_desc; nr; md++, nr--) {
                create_mapping(md);
@@ -1022,7 +1015,7 @@ void __init vm_reserve_area_early(unsigned long addr, unsigned long size,
        struct vm_struct *vm;
        struct static_vm *svm;
 
-       svm = early_alloc_aligned(sizeof(*svm), __alignof__(*svm));
+       svm = memblock_alloc(sizeof(*svm), __alignof__(*svm));
 
        vm = &svm->vm;
        vm->addr = (void *)addr;
index 75b7957..0be2898 100644 (file)
@@ -121,8 +121,6 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
  */
 void __init coherent_mem_init(phys_addr_t start, u32 size)
 {
-       phys_addr_t bitmap_phys;
-
        if (!size)
                return;
 
@@ -138,11 +136,8 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
        if (dma_size & (PAGE_SIZE - 1))
                ++dma_pages;
 
-       bitmap_phys = memblock_phys_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long),
-                                         sizeof(long));
-
-       dma_bitmap = phys_to_virt(bitmap_phys);
-       memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
+       dma_bitmap = memblock_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long),
+                                   sizeof(long));
 }
 
 static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
index 29fda12..23791dc 100644 (file)
@@ -45,5 +45,4 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
 # CONFIG_SYSFS is not set
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index 80624f4..7fc9c2f 100644 (file)
@@ -45,5 +45,4 @@ CONFIG_SERIAL_SH_SCI_EARLYCON=y
 # CONFIG_SYSFS is not set
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index 29fda12..23791dc 100644 (file)
@@ -45,5 +45,4 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
 # CONFIG_SYSFS is not set
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index 1ba10d5..0857cdb 100644 (file)
@@ -88,7 +88,6 @@ CONFIG_ROMFS_FS=y
 CONFIG_ROMFS_BACKED_BY_BOTH=y
 # CONFIG_NETWORK_FILESYSTEMS is not set
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
 CONFIG_PANIC_ON_OOPS=y
index 3d07b1d..69f23c7 100644 (file)
@@ -76,7 +76,6 @@ CONFIG_GPIO_GENERIC_PLATFORM=y
 CONFIG_FSCACHE=y
 # CONFIG_PROC_SYSCTL is not set
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
 CONFIG_SLUB_DEBUG_ON=y
 CONFIG_PANIC_ON_OOPS=y
index b17fd8a..44f4b89 100644 (file)
@@ -363,8 +363,9 @@ void __init *early_get_page(void)
         * Mem start + kernel_tlb -> here is limit
         * because of mem mapping from head.S
         */
-       return __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE,
-                               memory_start + kernel_tlb));
+       return memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE,
+                               MEMBLOCK_LOW_LIMIT, memory_start + kernel_tlb,
+                               NUMA_NO_NODE);
 }
 
 #endif /* CONFIG_MMU */
index 253f79f..d1e521c 100644 (file)
@@ -78,8 +78,7 @@ static void __init map_ram(void)
                }
 
                /* Alloc one page for holding PTE's... */
-               pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
-               memset(pte, 0, PAGE_SIZE);
+               pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
                set_pmd(pme, __pmd(__pa(pte) + _PAGE_KERNEL_TABLE));
 
                /* Fill the newly allocated page with PTE'S */
@@ -111,8 +110,7 @@ static void __init fixedrange_init(void)
        pgd = swapper_pg_dir + pgd_index(vaddr);
        pud = pud_offset(pgd, vaddr);
        pmd = pmd_offset(pud, vaddr);
-       fixmap_pmd_p = (pmd_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
-       memset(fixmap_pmd_p, 0, PAGE_SIZE);
+       fixmap_pmd_p = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
        set_pmd(pmd, __pmd(__pa(fixmap_pmd_p) + _PAGE_KERNEL_TABLE));
 
 #ifdef CONFIG_HIGHMEM
@@ -124,8 +122,7 @@ static void __init fixedrange_init(void)
        pgd = swapper_pg_dir + pgd_index(vaddr);
        pud = pud_offset(pgd, vaddr);
        pmd = pmd_offset(pud, vaddr);
-       pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
-       memset(pte, 0, PAGE_SIZE);
+       pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
        set_pmd(pmd, __pmd(__pa(pte) + _PAGE_KERNEL_TABLE));
        pkmap_page_table = pte;
 #endif /* CONFIG_HIGHMEM */
@@ -150,8 +147,7 @@ void __init paging_init(void)
        fixedrange_init();
 
        /* allocate space for empty_zero_page */
-       zero_page = __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
-       memset(zero_page, 0, PAGE_SIZE);
+       zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
        zone_sizes_init();
 
        empty_zero_page = virt_to_page(zero_page);
index c601c8f..7977ab7 100644 (file)
@@ -77,4 +77,3 @@ CONFIG_NFS_V3_ACL=y
 CONFIG_ROOT_NFS=y
 CONFIG_SUNRPC_DEBUG=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
index fce3358..ceb97cd 100644 (file)
@@ -74,4 +74,3 @@ CONFIG_NFS_V3_ACL=y
 CONFIG_ROOT_NFS=y
 CONFIG_SUNRPC_DEBUG=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
index 24fd84c..eb65f17 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/mm.h>
 #include <linux/extable.h>
 #include <linux/uaccess.h>
-#include <linux/ptrace.h>
 
 #include <asm/mmu_context.h>
 #include <asm/traps.h>
index a73aa90..d8ff4f8 100644 (file)
@@ -54,5 +54,4 @@ CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_DNOTIFY is not set
 CONFIG_TMPFS=y
 CONFIG_NFS_FS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
index b6e3c7e..6427899 100644 (file)
@@ -61,6 +61,5 @@ CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_TMPFS=y
 CONFIG_NFS_FS=y
 CONFIG_XZ_DEC=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_RCU_TRACE is not set
index 270d1c9..051bcb4 100644 (file)
@@ -122,13 +122,10 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm)
 {
        pte_t *pte;
 
-       if (likely(mem_init_done)) {
-               pte = (pte_t *) __get_free_page(GFP_KERNEL);
-       } else {
-               pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
-       }
+       if (likely(mem_init_done))
+               pte = (pte_t *)get_zeroed_page(GFP_KERNEL);
+       else
+               pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 
-       if (pte)
-               clear_page(pte);
        return pte;
 }
index c2b1c44..e4bfb11 100644 (file)
@@ -120,6 +120,5 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_CRYPTO_HW is not set
index 53687c3..7c6baf6 100644 (file)
@@ -1123,7 +1123,6 @@ CONFIG_NLS_ISO8859_15=m
 CONFIG_NLS_KOI8_R=m
 CONFIG_NLS_KOI8_U=m
 CONFIG_DEBUG_INFO=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 CONFIG_UNUSED_SYMBOLS=y
 CONFIG_HEADERS_CHECK=y
 CONFIG_MAGIC_SYSRQ=y
index b848012..8c890c6 100644 (file)
@@ -28,7 +28,7 @@
 static void *__init alloc_paca_data(unsigned long size, unsigned long align,
                                unsigned long limit, int cpu)
 {
-       unsigned long pa;
+       void *ptr;
        int nid;
 
        /*
@@ -43,17 +43,15 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
                nid = early_cpu_to_node(cpu);
        }
 
-       pa = memblock_alloc_base_nid(size, align, limit, nid, MEMBLOCK_NONE);
-       if (!pa) {
-               pa = memblock_alloc_base(size, align, limit);
-               if (!pa)
-                       panic("cannot allocate paca data");
-       }
+       ptr = memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
+                                    limit, nid);
+       if (!ptr)
+               panic("cannot allocate paca data");
 
        if (cpu == boot_cpuid)
                memblock_set_bottom_up(false);
 
-       return __va(pa);
+       return ptr;
 }
 
 #ifdef CONFIG_PPC_PSERIES
@@ -119,7 +117,6 @@ static struct slb_shadow * __init new_slb_shadow(int cpu, unsigned long limit)
        }
 
        s = alloc_paca_data(sizeof(*s), L1_CACHE_BYTES, limit, cpu);
-       memset(s, 0, sizeof(*s));
 
        s->persistent = cpu_to_be32(SLB_NUM_BOLTED);
        s->buffer_length = cpu_to_be32(sizeof(*s));
@@ -223,7 +220,6 @@ void __init allocate_paca(int cpu)
        paca = alloc_paca_data(sizeof(struct paca_struct), L1_CACHE_BYTES,
                                limit, cpu);
        paca_ptrs[cpu] = paca;
-       memset(paca, 0, sizeof(struct paca_struct));
 
        initialise_paca(paca, cpu);
 #ifdef CONFIG_PPC_PSERIES
index e7534f3..f17868e 100644 (file)
@@ -459,8 +459,8 @@ void __init smp_setup_cpu_maps(void)
 
        DBG("smp_setup_cpu_maps()\n");
 
-       cpu_to_phys_id = __va(memblock_phys_alloc(nr_cpu_ids * sizeof(u32), __alignof__(u32)));
-       memset(cpu_to_phys_id, 0, nr_cpu_ids * sizeof(u32));
+       cpu_to_phys_id = memblock_alloc(nr_cpu_ids * sizeof(u32),
+                                       __alignof__(u32));
 
        for_each_node_by_type(dn, "cpu") {
                const __be32 *intserv;
index daa361f..ff0aac4 100644 (file)
@@ -902,8 +902,9 @@ static void __ref init_fallback_flush(void)
         * hardware prefetch runoff. We don't have a recipe for load patterns to
         * reliably avoid the prefetcher.
         */
-       l1d_flush_fallback_area = __va(memblock_alloc_base(l1d_size * 2, l1d_size, limit));
-       memset(l1d_flush_fallback_area, 0, l1d_size * 2);
+       l1d_flush_fallback_area = memblock_alloc_try_nid(l1d_size * 2,
+                                               l1d_size, MEMBLOCK_LOW_LIMIT,
+                                               limit, NUMA_NO_NODE);
 
        for_each_possible_cpu(cpu) {
                struct paca_struct *paca = paca_ptrs[cpu];
index 4aa0797..3d4b239 100644 (file)
@@ -908,9 +908,9 @@ static void __init htab_initialize(void)
 #ifdef CONFIG_DEBUG_PAGEALLOC
        if (debug_pagealloc_enabled()) {
                linear_map_hash_count = memblock_end_of_DRAM() >> PAGE_SHIFT;
-               linear_map_hash_slots = __va(memblock_alloc_base(
-                               linear_map_hash_count, 1, ppc64_rma_size));
-               memset(linear_map_hash_slots, 0, linear_map_hash_count);
+               linear_map_hash_slots = memblock_alloc_try_nid(
+                               linear_map_hash_count, 1, MEMBLOCK_LOW_LIMIT,
+                               ppc64_rma_size, NUMA_NO_NODE);
        }
 #endif /* CONFIG_DEBUG_PAGEALLOC */
 
index e0ccf36..53cbc7d 100644 (file)
@@ -57,12 +57,8 @@ void vmemmap_remove_mapping(unsigned long start,
 
 static __ref void *early_alloc_pgtable(unsigned long size)
 {
-       void *pt;
-
-       pt = __va(memblock_alloc_base(size, size, __pa(MAX_DMA_ADDRESS)));
-       memset(pt, 0, size);
-
-       return pt;
+       return memblock_alloc_try_nid(size, size, MEMBLOCK_LOW_LIMIT,
+                                     __pa(MAX_DMA_ADDRESS), NUMA_NO_NODE);
 }
 
 /*
index e7da590..92a3e4c 100644 (file)
@@ -195,11 +195,8 @@ void __init mmu_partition_table_init(void)
        unsigned long ptcr;
 
        BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 36), "Partition table size too large.");
-       partition_tb = __va(memblock_alloc_base(patb_size, patb_size,
-                                               MEMBLOCK_ALLOC_ANYWHERE));
-
        /* Initialize the Partition Table with no entries */
-       memset((void *)partition_tb, 0, patb_size);
+       partition_tb = memblock_alloc(patb_size, patb_size);
 
        /*
         * update partition table control register,
index dced3cd..e377684 100644 (file)
@@ -51,26 +51,15 @@ static int native_register_process_table(unsigned long base, unsigned long pg_sz
 static __ref void *early_alloc_pgtable(unsigned long size, int nid,
                        unsigned long region_start, unsigned long region_end)
 {
-       unsigned long pa = 0;
-       void *pt;
+       phys_addr_t min_addr = MEMBLOCK_LOW_LIMIT;
+       phys_addr_t max_addr = MEMBLOCK_ALLOC_ANYWHERE;
 
-       if (region_start || region_end) /* has region hint */
-               pa = memblock_alloc_range(size, size, region_start, region_end,
-                                               MEMBLOCK_NONE);
-       else if (nid != -1) /* has node hint */
-               pa = memblock_alloc_base_nid(size, size,
-                                               MEMBLOCK_ALLOC_ANYWHERE,
-                                               nid, MEMBLOCK_NONE);
+       if (region_start)
+               min_addr = region_start;
+       if (region_end)
+               max_addr = region_end;
 
-       if (!pa)
-               pa = memblock_alloc_base(size, size, MEMBLOCK_ALLOC_ANYWHERE);
-
-       BUG_ON(!pa);
-
-       pt = __va(pa);
-       memset(pt, 0, size);
-
-       return pt;
+       return memblock_alloc_try_nid(size, size, min_addr, max_addr, nid);
 }
 
 static int early_map_kernel_page(unsigned long ea, unsigned long pa,
index 2d5b0d5..6c8a60b 100644 (file)
@@ -339,8 +339,7 @@ void __init MMU_init_hw(void)
         * Find some memory for the hash table.
         */
        if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322);
-       Hash = __va(memblock_phys_alloc(Hash_size, Hash_size));
-       memset(Hash, 0, Hash_size);
+       Hash = memblock_alloc(Hash_size, Hash_size);
        _SDR1 = __pa(Hash) | SDR1_LOW_BITS;
 
        Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size);
index bbeb6a1..86368e2 100644 (file)
@@ -208,7 +208,9 @@ static int __init iob_init(struct device_node *dn)
        pr_debug(" -> %s\n", __func__);
 
        /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */
-       iob_l2_base = (u32 *)__va(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000));
+       iob_l2_base = memblock_alloc_try_nid_raw(1UL << 21, 1UL << 21,
+                                       MEMBLOCK_LOW_LIMIT, 0x80000000,
+                                       NUMA_NO_NODE);
 
        pr_info("IOBMAP L2 allocated at: %p\n", iob_l2_base);
 
@@ -269,4 +271,3 @@ void __init iommu_init_early_pasemi(void)
        pasemi_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pasemi;
        set_pci_dma_ops(&dma_iommu_ops);
 }
-
index 2ca3ba9..727a7de 100644 (file)
@@ -170,8 +170,7 @@ int __init early_init_dt_scan_recoverable_ranges(unsigned long node,
        /*
         * Allocate a buffer to hold the MC recoverable ranges.
         */
-       mc_recoverable_range =__va(memblock_phys_alloc(size, __alignof__(u64)));
-       memset(mc_recoverable_range, 0, size);
+       mc_recoverable_range = memblock_alloc(size, __alignof__(u64));
 
        for (i = 0; i < mc_recoverable_range_len; i++) {
                mc_recoverable_range[i].start_addr =
index 41f62ca..e4f0dfd 100644 (file)
@@ -130,8 +130,13 @@ static void __init fwnmi_init(void)
         * It will be used in real mode mce handler, hence it needs to be
         * below RMA.
         */
-       mce_data_buf = __va(memblock_alloc_base(RTAS_ERROR_LOG_MAX * nr_cpus,
-                                       RTAS_ERROR_LOG_MAX, ppc64_rma_size));
+       mce_data_buf = memblock_alloc_try_nid_raw(RTAS_ERROR_LOG_MAX * nr_cpus,
+                                       RTAS_ERROR_LOG_MAX, MEMBLOCK_LOW_LIMIT,
+                                       ppc64_rma_size, NUMA_NO_NODE);
+       if (!mce_data_buf)
+               panic("Failed to allocate %d bytes below %pa for MCE buffer\n",
+                     RTAS_ERROR_LOG_MAX * nr_cpus, &ppc64_rma_size);
+
        for_each_possible_cpu(i) {
                paca_ptrs[i]->mce_data_buf = mce_data_buf +
                                                (RTAS_ERROR_LOG_MAX * i);
@@ -140,8 +145,13 @@ static void __init fwnmi_init(void)
 #ifdef CONFIG_PPC_BOOK3S_64
        /* Allocate per cpu slb area to save old slb contents during MCE */
        size = sizeof(struct slb_entry) * mmu_slb_size * nr_cpus;
-       slb_ptr = __va(memblock_alloc_base(size, sizeof(struct slb_entry),
-                                          ppc64_rma_size));
+       slb_ptr = memblock_alloc_try_nid_raw(size, sizeof(struct slb_entry),
+                                       MEMBLOCK_LOW_LIMIT, ppc64_rma_size,
+                                       NUMA_NO_NODE);
+       if (!slb_ptr)
+               panic("Failed to allocate %zu bytes below %pa for slb area\n",
+                     size, &ppc64_rma_size);
+
        for_each_possible_cpu(i)
                paca_ptrs[i]->mce_faulty_slbs = slb_ptr + (mmu_slb_size * i);
 #endif
index 809797d..fc5c5c2 100644 (file)
@@ -251,8 +251,11 @@ static void allocate_dart(void)
         * 16MB (1 << 24) alignment. We allocate a full 16Mb chuck since we
         * will blow up an entire large page anyway in the kernel mapping.
         */
-       dart_tablebase = __va(memblock_alloc_base(1UL<<24,
-                                                 1UL<<24, 0x80000000L));
+       dart_tablebase = memblock_alloc_try_nid_raw(SZ_16M, SZ_16M,
+                                       MEMBLOCK_LOW_LIMIT, SZ_2G,
+                                       NUMA_NO_NODE);
+       if (!dart_tablebase)
+               panic("Failed to allocate 16MB below 2GB for DART table\n");
 
        /* There is no point scanning the DART space for leaks*/
        kmemleak_no_scan((void *)dart_tablebase);
index d31bde0..2d1271e 100644 (file)
@@ -58,18 +58,6 @@ EXPORT_SYMBOL(__node_distance);
 int numa_debug_enabled;
 
 /*
- * alloc_node_data() - Allocate node data
- */
-static __init pg_data_t *alloc_node_data(void)
-{
-       pg_data_t *res;
-
-       res = (pg_data_t *) memblock_phys_alloc(sizeof(pg_data_t), 8);
-       memset(res, 0, sizeof(pg_data_t));
-       return res;
-}
-
-/*
  * numa_setup_memory() - Assign bootmem to nodes
  *
  * The memory is first added to memblock without any respect to nodes.
@@ -105,7 +93,7 @@ static void __init numa_setup_memory(void)
 
        /* Allocate and fill out node_data */
        for (nid = 0; nid < MAX_NUMNODES; nid++)
-               NODE_DATA(nid) = alloc_node_data();
+               NODE_DATA(nid) = memblock_alloc(sizeof(pg_data_t), 8);
 
        for_each_online_node(nid) {
                unsigned long start_pfn, end_pfn;
index 4710df4..6c7cdc3 100644 (file)
@@ -81,7 +81,6 @@ CONFIG_NLS_CODEPAGE_932=y
 CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
index db756e0..ef7cc31 100644 (file)
@@ -32,6 +32,5 @@ CONFIG_SH_PCLK_FREQ=31250000
 # CONFIG_DNOTIFY is not set
 # CONFIG_PROC_FS is not set
 # CONFIG_SYSFS is not set
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_CRC32 is not set
index 2985fe7..444d759 100644 (file)
@@ -111,7 +111,6 @@ CONFIG_NLS_ISO8859_15=y
 CONFIG_NLS_KOI8_R=y
 CONFIG_NLS_KOI8_U=y
 CONFIG_NLS_UTF8=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
index e9ee0c8..d16e933 100644 (file)
@@ -209,7 +209,6 @@ CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_ISO8859_15=m
 CONFIG_NLS_UTF8=m
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
index 34094e0..a1cf644 100644 (file)
@@ -157,7 +157,6 @@ CONFIG_NLS_ISO8859_15=y
 CONFIG_NLS_KOI8_R=y
 CONFIG_NLS_KOI8_U=y
 CONFIG_NLS_UTF8=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
index d15e536..d04bc27 100644 (file)
@@ -40,6 +40,5 @@ CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_PROC_FS is not set
 # CONFIG_SYSFS is not set
 # CONFIG_MISC_FILESYSTEMS is not set
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_CRC32 is not set
index 2ef780f..405bf62 100644 (file)
@@ -113,7 +113,6 @@ CONFIG_NLS_ISO8859_15=y
 CONFIG_NLS_KOI8_R=y
 CONFIG_NLS_KOI8_U=y
 CONFIG_NLS_UTF8=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
index 742634b..e5b733c 100644 (file)
@@ -42,6 +42,5 @@ CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_PROC_FS is not set
 # CONFIG_SYSFS is not set
 # CONFIG_MISC_FILESYSTEMS is not set
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_CRC32 is not set
index 7098828..5201bb7 100644 (file)
@@ -109,7 +109,6 @@ CONFIG_NFSD_V4=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_CODEPAGE_932=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_HUNG_TASK=y
index 5f2921a..1b7412d 100644 (file)
@@ -82,7 +82,6 @@ CONFIG_NFSD=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_CODEPAGE_932=y
 CONFIG_NLS_ISO8859_1=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_CRYPTO_MICHAEL_MIC=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
index 7d5591b..f891045 100644 (file)
@@ -136,7 +136,6 @@ CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_CODEPAGE_932=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
index a8e5c0e..a0fa4de 100644 (file)
@@ -192,24 +192,16 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
 void __init allocate_pgdat(unsigned int nid)
 {
        unsigned long start_pfn, end_pfn;
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-       unsigned long phys;
-#endif
 
        get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
 
 #ifdef CONFIG_NEED_MULTIPLE_NODES
-       phys = __memblock_alloc_base(sizeof(struct pglist_data),
-                               SMP_CACHE_BYTES, end_pfn << PAGE_SHIFT);
-       /* Retry with all of system memory */
-       if (!phys)
-               phys = __memblock_alloc_base(sizeof(struct pglist_data),
-                                       SMP_CACHE_BYTES, memblock_end_of_DRAM());
-       if (!phys)
+       NODE_DATA(nid) = memblock_alloc_try_nid_nopanic(
+                               sizeof(struct pglist_data),
+                               SMP_CACHE_BYTES, MEMBLOCK_LOW_LIMIT,
+                               MEMBLOCK_ALLOC_ACCESSIBLE, nid);
+       if (!NODE_DATA(nid))
                panic("Can't allocate pgdat for node %d\n", nid);
-
-       NODE_DATA(nid) = __va(phys);
-       memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
 #endif
 
        NODE_DATA(nid)->node_start_pfn = start_pfn;
index 830e8b3..c4bde61 100644 (file)
@@ -41,9 +41,8 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
        __add_active_range(nid, start_pfn, end_pfn);
 
        /* Node-local pgdat */
-       NODE_DATA(nid) = __va(memblock_alloc_base(sizeof(struct pglist_data),
-                                            SMP_CACHE_BYTES, end));
-       memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
+       NODE_DATA(nid) = memblock_alloc_node(sizeof(struct pglist_data),
+                                            SMP_CACHE_BYTES, nid);
 
        NODE_DATA(nid)->node_start_pfn = start_pfn;
        NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
index 207a43a..2d4f34c 100644 (file)
@@ -75,7 +75,6 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_RPCSEC_GSS_KRB5=m
 CONFIG_NLS=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_HUNG_TASK=y
 # CONFIG_SCHED_DEBUG is not set
index 4d4e1cc..ea547d5 100644 (file)
@@ -201,7 +201,6 @@ CONFIG_PROC_KCORE=y
 CONFIG_TMPFS=y
 CONFIG_HUGETLBFS=y
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_LOCKUP_DETECTOR=y
index e897a4d..c50ff1f 100644 (file)
 
 void * __init prom_early_alloc(unsigned long size)
 {
-       unsigned long paddr = memblock_phys_alloc(size, SMP_CACHE_BYTES);
-       void *ret;
+       void *ret = memblock_alloc(size, SMP_CACHE_BYTES);
 
-       if (!paddr) {
+       if (!ret) {
                prom_printf("prom_early_alloc(%lu) failed\n", size);
                prom_halt();
        }
 
-       ret = __va(paddr);
-       memset(ret, 0, size);
        prom_early_allocated += size;
 
        return ret;
index 9e6bd86..ef340e8 100644 (file)
@@ -1089,16 +1089,13 @@ static void __init allocate_node_data(int nid)
        struct pglist_data *p;
        unsigned long start_pfn, end_pfn;
 #ifdef CONFIG_NEED_MULTIPLE_NODES
-       unsigned long paddr;
 
-       paddr = memblock_phys_alloc_try_nid(sizeof(struct pglist_data),
-                                           SMP_CACHE_BYTES, nid);
-       if (!paddr) {
+       NODE_DATA(nid) = memblock_alloc_node(sizeof(struct pglist_data),
+                                            SMP_CACHE_BYTES, nid);
+       if (!NODE_DATA(nid)) {
                prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid);
                prom_halt();
        }
-       NODE_DATA(nid) = __va(paddr);
-       memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
 
        NODE_DATA(nid)->node_id = nid;
 #endif
index 85ef2c6..74b6a2e 100644 (file)
@@ -274,30 +274,6 @@ void __init mem_init(void)
        memblock_free_all();
 
        mem_init_print_info(NULL);
-       printk(KERN_NOTICE "Virtual kernel memory layout:\n"
-               "    vector  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
-               "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-               "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-               "    modules : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-               "      .init : 0x%p" " - 0x%p" "   (%4d kB)\n"
-               "      .text : 0x%p" " - 0x%p" "   (%4d kB)\n"
-               "      .data : 0x%p" " - 0x%p" "   (%4d kB)\n",
-
-               VECTORS_BASE, VECTORS_BASE + PAGE_SIZE,
-               DIV_ROUND_UP(PAGE_SIZE, SZ_1K),
-               VMALLOC_START, VMALLOC_END,
-               DIV_ROUND_UP((VMALLOC_END - VMALLOC_START), SZ_1M),
-               PAGE_OFFSET, (unsigned long)high_memory,
-               DIV_ROUND_UP(((unsigned long)high_memory - PAGE_OFFSET), SZ_1M),
-               MODULES_VADDR, MODULES_END,
-               DIV_ROUND_UP((MODULES_END - MODULES_VADDR), SZ_1M),
-
-               __init_begin, __init_end,
-               DIV_ROUND_UP((__init_end - __init_begin), SZ_1K),
-               _stext, _etext,
-               DIV_ROUND_UP((_etext - _stext), SZ_1K),
-               _sdata, _edata,
-               DIV_ROUND_UP((_edata - _sdata), SZ_1K));
 
        BUILD_BUG_ON(TASK_SIZE                          > MODULES_VADDR);
        BUG_ON(TASK_SIZE                                > MODULES_VADDR);
index 040a8c2..a402192 100644 (file)
@@ -141,18 +141,12 @@ static void __init build_mem_type_table(void)
 
 #define vectors_base() (vectors_high() ? 0xffff0000 : 0)
 
-static void __init *early_alloc(unsigned long sz)
-{
-       void *ptr = __va(memblock_phys_alloc(sz, sz));
-       memset(ptr, 0, sz);
-       return ptr;
-}
-
 static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr,
                unsigned long prot)
 {
        if (pmd_none(*pmd)) {
-               pte_t *pte = early_alloc(PTRS_PER_PTE * sizeof(pte_t));
+               pte_t *pte = memblock_alloc(PTRS_PER_PTE * sizeof(pte_t),
+                                           PTRS_PER_PTE * sizeof(pte_t));
                __pmd_populate(pmd, __pa(pte) | prot);
        }
        BUG_ON(pmd_bad(*pmd));
@@ -354,7 +348,7 @@ static void __init devicemaps_init(void)
        /*
         * Allocate the vector page early.
         */
-       vectors = early_alloc(PAGE_SIZE);
+       vectors = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 
        for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
                pmd_clear(pmd_off_k(addr));
@@ -431,7 +425,7 @@ void __init paging_init(void)
        top_pmd = pmd_off_k(0xffff0000);
 
        /* allocate the zero page. */
-       zero_page = early_alloc(PAGE_SIZE);
+       zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 
        bootmem_init();
 
index 5d946f4..9f90811 100644 (file)
@@ -287,7 +287,6 @@ CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_UNUSED_SYMBOLS is not set
index 300ad56..1d3badf 100644 (file)
@@ -286,7 +286,6 @@ CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
 CONFIG_PRINTK_TIME=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_KERNEL=y
index 9d5c75f..667f1da 100644 (file)
@@ -1031,7 +1031,7 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
 
 static void
 do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
-         unsigned int fault)
+         vm_fault_t fault)
 {
        struct task_struct *tsk = current;
 
index 799ed5e..fb5bf2a 100644 (file)
@@ -128,7 +128,7 @@ obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o
 obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o
 obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o
 obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
-obj-$(CONFIG_CRYPTO_LZO) += lzo.o
+obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o
 obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
 obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
 obj-$(CONFIG_CRYPTO_842) += 842.o
diff --git a/crypto/lzo-rle.c b/crypto/lzo-rle.c
new file mode 100644 (file)
index 0000000..ea9c75b
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Cryptographic API.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/crypto.h>
+#include <linux/vmalloc.h>
+#include <linux/mm.h>
+#include <linux/lzo.h>
+#include <crypto/internal/scompress.h>
+
+struct lzorle_ctx {
+       void *lzorle_comp_mem;
+};
+
+static void *lzorle_alloc_ctx(struct crypto_scomp *tfm)
+{
+       void *ctx;
+
+       ctx = kvmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
+       if (!ctx)
+               return ERR_PTR(-ENOMEM);
+
+       return ctx;
+}
+
+static int lzorle_init(struct crypto_tfm *tfm)
+{
+       struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       ctx->lzorle_comp_mem = lzorle_alloc_ctx(NULL);
+       if (IS_ERR(ctx->lzorle_comp_mem))
+               return -ENOMEM;
+
+       return 0;
+}
+
+static void lzorle_free_ctx(struct crypto_scomp *tfm, void *ctx)
+{
+       kvfree(ctx);
+}
+
+static void lzorle_exit(struct crypto_tfm *tfm)
+{
+       struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       lzorle_free_ctx(NULL, ctx->lzorle_comp_mem);
+}
+
+static int __lzorle_compress(const u8 *src, unsigned int slen,
+                         u8 *dst, unsigned int *dlen, void *ctx)
+{
+       size_t tmp_len = *dlen; /* size_t(ulong) <-> uint on 64 bit */
+       int err;
+
+       err = lzorle1x_1_compress(src, slen, dst, &tmp_len, ctx);
+
+       if (err != LZO_E_OK)
+               return -EINVAL;
+
+       *dlen = tmp_len;
+       return 0;
+}
+
+static int lzorle_compress(struct crypto_tfm *tfm, const u8 *src,
+                       unsigned int slen, u8 *dst, unsigned int *dlen)
+{
+       struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       return __lzorle_compress(src, slen, dst, dlen, ctx->lzorle_comp_mem);
+}
+
+static int lzorle_scompress(struct crypto_scomp *tfm, const u8 *src,
+                        unsigned int slen, u8 *dst, unsigned int *dlen,
+                        void *ctx)
+{
+       return __lzorle_compress(src, slen, dst, dlen, ctx);
+}
+
+static int __lzorle_decompress(const u8 *src, unsigned int slen,
+                           u8 *dst, unsigned int *dlen)
+{
+       int err;
+       size_t tmp_len = *dlen; /* size_t(ulong) <-> uint on 64 bit */
+
+       err = lzo1x_decompress_safe(src, slen, dst, &tmp_len);
+
+       if (err != LZO_E_OK)
+               return -EINVAL;
+
+       *dlen = tmp_len;
+       return 0;
+}
+
+static int lzorle_decompress(struct crypto_tfm *tfm, const u8 *src,
+                         unsigned int slen, u8 *dst, unsigned int *dlen)
+{
+       return __lzorle_decompress(src, slen, dst, dlen);
+}
+
+static int lzorle_sdecompress(struct crypto_scomp *tfm, const u8 *src,
+                          unsigned int slen, u8 *dst, unsigned int *dlen,
+                          void *ctx)
+{
+       return __lzorle_decompress(src, slen, dst, dlen);
+}
+
+static struct crypto_alg alg = {
+       .cra_name               = "lzo-rle",
+       .cra_flags              = CRYPTO_ALG_TYPE_COMPRESS,
+       .cra_ctxsize            = sizeof(struct lzorle_ctx),
+       .cra_module             = THIS_MODULE,
+       .cra_init               = lzorle_init,
+       .cra_exit               = lzorle_exit,
+       .cra_u                  = { .compress = {
+       .coa_compress           = lzorle_compress,
+       .coa_decompress         = lzorle_decompress } }
+};
+
+static struct scomp_alg scomp = {
+       .alloc_ctx              = lzorle_alloc_ctx,
+       .free_ctx               = lzorle_free_ctx,
+       .compress               = lzorle_scompress,
+       .decompress             = lzorle_sdecompress,
+       .base                   = {
+               .cra_name       = "lzo-rle",
+               .cra_driver_name = "lzo-rle-scomp",
+               .cra_module      = THIS_MODULE,
+       }
+};
+
+static int __init lzorle_mod_init(void)
+{
+       int ret;
+
+       ret = crypto_register_alg(&alg);
+       if (ret)
+               return ret;
+
+       ret = crypto_register_scomp(&scomp);
+       if (ret) {
+               crypto_unregister_alg(&alg);
+               return ret;
+       }
+
+       return ret;
+}
+
+static void __exit lzorle_mod_fini(void)
+{
+       crypto_unregister_alg(&alg);
+       crypto_unregister_scomp(&scomp);
+}
+
+module_init(lzorle_mod_init);
+module_exit(lzorle_mod_fini);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("LZO-RLE Compression Algorithm");
+MODULE_ALIAS_CRYPTO("lzo-rle");
index e7fb87e..1ea2d50 100644 (file)
@@ -76,8 +76,8 @@ static char *check[] = {
        "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
        "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta",  "fcrypt",
        "camellia", "seed", "salsa20", "rmd128", "rmd160", "rmd256", "rmd320",
-       "lzo", "cts", "sha3-224", "sha3-256", "sha3-384", "sha3-512",
-       "streebog256", "streebog512",
+       "lzo", "lzo-rle", "cts", "sha3-224", "sha3-256", "sha3-384",
+       "sha3-512", "streebog256", "streebog512",
        NULL
 };
 
index 4ed0a78..4d9a388 100644 (file)
@@ -20,6 +20,7 @@
 
 static const char * const backends[] = {
        "lzo",
+       "lzo-rle",
 #if IS_ENABLED(CONFIG_CRYPTO_LZ4)
        "lz4",
 #endif
index cbe467f..1e1f42e 100644 (file)
@@ -2149,6 +2149,7 @@ static void mport_release_mapping(struct kref *ref)
        switch (map->dir) {
        case MAP_INBOUND:
                rio_unmap_inb_region(mport, map->phys_addr);
+               /* fall through */
        case MAP_DMA:
                dma_free_coherent(mport->dev.parent, map->size,
                                  map->virt_addr, map->phys_addr);
index bad0e0e..cf45829 100644 (file)
@@ -1215,7 +1215,9 @@ static int riocm_ch_listen(u16 ch_id)
        riocm_debug(CHOP, "(ch_%d)", ch_id);
 
        ch = riocm_get_channel(ch_id);
-       if (!ch || !riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN))
+       if (!ch)
+               return -EINVAL;
+       if (!riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN))
                ret = -EINVAL;
        riocm_put_channel(ch);
        return ret;
index 3e59f0e..70c132a 100644 (file)
@@ -105,6 +105,7 @@ struct autofs_wait_queue {
 
 #define AUTOFS_SBI_CATATONIC   0x0001
 #define AUTOFS_SBI_STRICTEXPIRE 0x0002
+#define AUTOFS_SBI_IGNORE      0x0004
 
 struct autofs_sb_info {
        u32 magic;
@@ -215,6 +216,8 @@ static inline int autofs_prepare_pipe(struct file *pipe)
                return -EINVAL;
        /* We want a packet pipe */
        pipe->f_flags |= O_DIRECT;
+       /* We don't expect -EAGAIN */
+       pipe->f_flags &= ~O_NONBLOCK;
        return 0;
 }
 
index 078992e..80597b8 100644 (file)
@@ -82,18 +82,20 @@ static int autofs_show_options(struct seq_file *m, struct dentry *root)
        seq_printf(m, ",maxproto=%d", sbi->max_proto);
 
        if (autofs_type_offset(sbi->type))
-               seq_printf(m, ",offset");
+               seq_puts(m, ",offset");
        else if (autofs_type_direct(sbi->type))
-               seq_printf(m, ",direct");
+               seq_puts(m, ",direct");
        else
-               seq_printf(m, ",indirect");
+               seq_puts(m, ",indirect");
        if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)
-               seq_printf(m, ",strictexpire");
+               seq_puts(m, ",strictexpire");
+       if (sbi->flags & AUTOFS_SBI_IGNORE)
+               seq_puts(m, ",ignore");
 #ifdef CONFIG_CHECKPOINT_RESTORE
        if (sbi->pipe)
                seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);
        else
-               seq_printf(m, ",pipe_ino=-1");
+               seq_puts(m, ",pipe_ino=-1");
 #endif
        return 0;
 }
@@ -111,7 +113,8 @@ static const struct super_operations autofs_sops = {
 };
 
 enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
-       Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire};
+       Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire,
+       Opt_ignore};
 
 static const match_table_t tokens = {
        {Opt_fd, "fd=%u"},
@@ -124,6 +127,7 @@ static const match_table_t tokens = {
        {Opt_direct, "direct"},
        {Opt_offset, "offset"},
        {Opt_strictexpire, "strictexpire"},
+       {Opt_ignore, "ignore"},
        {Opt_err, NULL}
 };
 
@@ -206,6 +210,9 @@ static int parse_options(char *options,
                case Opt_strictexpire:
                        sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
                        break;
+               case Opt_ignore:
+                       sbi->flags |= AUTOFS_SBI_IGNORE;
+                       break;
                default:
                        return 1;
                }
index 5420732..7d09d12 100644 (file)
@@ -57,8 +57,6 @@
 #endif
 
 static int load_elf_binary(struct linux_binprm *bprm);
-static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *,
-                               int, int, unsigned long);
 
 #ifdef CONFIG_USELIB
 static int load_elf_library(struct file *);
@@ -347,7 +345,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 #ifndef elf_map
 
 static unsigned long elf_map(struct file *filep, unsigned long addr,
-               struct elf_phdr *eppnt, int prot, int type,
+               const struct elf_phdr *eppnt, int prot, int type,
                unsigned long total_size)
 {
        unsigned long map_addr;
@@ -387,7 +385,7 @@ static unsigned long elf_map(struct file *filep, unsigned long addr,
 
 #endif /* !elf_map */
 
-static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
+static unsigned long total_mapping_size(const struct elf_phdr *cmds, int nr)
 {
        int i, first_idx = -1, last_idx = -1;
 
@@ -414,12 +412,13 @@ static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
  * header pointed to by elf_ex, into a newly allocated array. The caller is
  * responsible for freeing the allocated data. Returns an ERR_PTR upon failure.
  */
-static struct elf_phdr *load_elf_phdrs(struct elfhdr *elf_ex,
+static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex,
                                       struct file *elf_file)
 {
        struct elf_phdr *elf_phdata = NULL;
-       int retval, size, err = -1;
+       int retval, err = -1;
        loff_t pos = elf_ex->e_phoff;
+       unsigned int size;
 
        /*
         * If the size of this structure has changed, then punt, since
@@ -429,13 +428,9 @@ static struct elf_phdr *load_elf_phdrs(struct elfhdr *elf_ex,
                goto out;
 
        /* Sanity check the number of program headers... */
-       if (elf_ex->e_phnum < 1 ||
-               elf_ex->e_phnum > 65536U / sizeof(struct elf_phdr))
-               goto out;
-
        /* ...and their total size. */
        size = sizeof(struct elf_phdr) * elf_ex->e_phnum;
-       if (size > ELF_MIN_ALIGN)
+       if (size == 0 || size > 65536 || size > ELF_MIN_ALIGN)
                goto out;
 
        elf_phdata = kmalloc(size, GFP_KERNEL);
@@ -2033,7 +2028,6 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
                          struct elf_note_info *info,
                          const kernel_siginfo_t *siginfo, struct pt_regs *regs)
 {
-       struct list_head *t;
        struct core_thread *ct;
        struct elf_thread_status *ets;
 
@@ -2050,10 +2044,9 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
                list_add(&ets->list, &info->thread_list);
        }
 
-       list_for_each(t, &info->thread_list) {
+       list_for_each_entry(ets, &info->thread_list, list) {
                int sz;
 
-               ets = list_entry(t, struct elf_thread_status, list);
                sz = elf_dump_thread_status(siginfo->si_signo, ets);
                info->thread_status_size += sz;
        }
@@ -2117,20 +2110,17 @@ static size_t get_note_info_size(struct elf_note_info *info)
 static int write_note_info(struct elf_note_info *info,
                           struct coredump_params *cprm)
 {
+       struct elf_thread_status *ets;
        int i;
-       struct list_head *t;
 
        for (i = 0; i < info->numnote; i++)
                if (!writenote(info->notes + i, cprm))
                        return 0;
 
        /* write out the thread status notes section */
-       list_for_each(t, &info->thread_list) {
-               struct elf_thread_status *tmp =
-                               list_entry(t, struct elf_thread_status, list);
-
-               for (i = 0; i < tmp->num_notes; i++)
-                       if (!writenote(&tmp->notes[i], cprm))
+       list_for_each_entry(ets, &info->thread_list, list) {
+               for (i = 0; i < ets->num_notes; i++)
+                       if (!writenote(&ets->notes[i], cprm))
                                return 0;
        }
 
index 8514091..129d262 100644 (file)
@@ -3449,31 +3449,17 @@ void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
 
 #if defined(CONFIG_DYNAMIC_DEBUG)
 #define btrfs_debug(fs_info, fmt, args...)                             \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))         \
-               btrfs_printk(fs_info, KERN_DEBUG fmt, ##args);          \
-} while (0)
-#define btrfs_debug_in_rcu(fs_info, fmt, args...)                      \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))                 \
-               btrfs_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args);   \
-} while (0)
+       _dynamic_func_call_no_desc(fmt, btrfs_printk,                   \
+                                  fs_info, KERN_DEBUG fmt, ##args)
+#define btrfs_debug_in_rcu(fs_info, fmt, args...)                      \
+       _dynamic_func_call_no_desc(fmt, btrfs_printk_in_rcu,            \
+                                  fs_info, KERN_DEBUG fmt, ##args)
 #define btrfs_debug_rl_in_rcu(fs_info, fmt, args...)                   \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))         \
-               btrfs_printk_rl_in_rcu(fs_info, KERN_DEBUG fmt,         \
-                                      ##args);\
-} while (0)
-#define btrfs_debug_rl(fs_info, fmt, args...)                          \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))         \
-               btrfs_printk_ratelimited(fs_info, KERN_DEBUG fmt,       \
-                                        ##args);                       \
-} while (0)
+       _dynamic_func_call_no_desc(fmt, btrfs_printk_rl_in_rcu,         \
+                                  fs_info, KERN_DEBUG fmt, ##args)
+#define btrfs_debug_rl(fs_info, fmt, args...)                          \
+       _dynamic_func_call_no_desc(fmt, btrfs_printk_ratelimited,       \
+                                  fs_info, KERN_DEBUG fmt, ##args)
 #elif defined(DEBUG)
 #define btrfs_debug(fs_info, fmt, args...) \
        btrfs_printk(fs_info, KERN_DEBUG fmt, ##args)
index a5d219d..4a0e98d 100644 (file)
  *
  * 1) epmutex (mutex)
  * 2) ep->mtx (mutex)
- * 3) ep->wq.lock (spinlock)
+ * 3) ep->lock (rwlock)
  *
  * The acquire order is the one listed above, from 1 to 3.
- * We need a spinlock (ep->wq.lock) because we manipulate objects
+ * We need a rwlock (ep->lock) because we manipulate objects
  * from inside the poll callback, that might be triggered from
  * a wake_up() that in turn might be called from IRQ context.
  * So we can't sleep inside the poll callback and hence we need
@@ -85,7 +85,7 @@
  * of epoll file descriptors, we use the current recursion depth as
  * the lockdep subkey.
  * It is possible to drop the "ep->mtx" and to use the global
- * mutex "epmutex" (together with "ep->wq.lock") to have it working,
+ * mutex "epmutex" (together with "ep->lock") to have it working,
  * but having "ep->mtx" will make the interface more scalable.
  * Events that require holding "epmutex" are very rare, while for
  * normal operations the epoll private "ep->mtx" will guarantee
@@ -182,8 +182,6 @@ struct epitem {
  * This structure is stored inside the "private_data" member of the file
  * structure and represents the main data structure for the eventpoll
  * interface.
- *
- * Access to it is protected by the lock inside wq.
  */
 struct eventpoll {
        /*
@@ -203,13 +201,16 @@ struct eventpoll {
        /* List of ready file descriptors */
        struct list_head rdllist;
 
+       /* Lock which protects rdllist and ovflist */
+       rwlock_t lock;
+
        /* RB tree root used to store monitored fd structs */
        struct rb_root_cached rbr;
 
        /*
         * This is a single linked list that chains all the "struct epitem" that
         * happened while transferring ready events to userspace w/out
-        * holding ->wq.lock.
+        * holding ->lock.
         */
        struct epitem *ovflist;
 
@@ -697,17 +698,17 @@ static __poll_t ep_scan_ready_list(struct eventpoll *ep,
         * because we want the "sproc" callback to be able to do it
         * in a lockless way.
         */
-       spin_lock_irq(&ep->wq.lock);
+       write_lock_irq(&ep->lock);
        list_splice_init(&ep->rdllist, &txlist);
        WRITE_ONCE(ep->ovflist, NULL);
-       spin_unlock_irq(&ep->wq.lock);
+       write_unlock_irq(&ep->lock);
 
        /*
         * Now call the callback function.
         */
        res = (*sproc)(ep, &txlist, priv);
 
-       spin_lock_irq(&ep->wq.lock);
+       write_lock_irq(&ep->lock);
        /*
         * During the time we spent inside the "sproc" callback, some
         * other events might have been queued by the poll callback.
@@ -722,7 +723,11 @@ static __poll_t ep_scan_ready_list(struct eventpoll *ep,
                 * contain them, and the list_splice() below takes care of them.
                 */
                if (!ep_is_linked(epi)) {
-                       list_add_tail(&epi->rdllink, &ep->rdllist);
+                       /*
+                        * ->ovflist is LIFO, so we have to reverse it in order
+                        * to keep in FIFO.
+                        */
+                       list_add(&epi->rdllink, &ep->rdllist);
                        ep_pm_stay_awake(epi);
                }
        }
@@ -745,11 +750,11 @@ static __poll_t ep_scan_ready_list(struct eventpoll *ep,
                 * the ->poll() wait list (delayed after we release the lock).
                 */
                if (waitqueue_active(&ep->wq))
-                       wake_up_locked(&ep->wq);
+                       wake_up(&ep->wq);
                if (waitqueue_active(&ep->poll_wait))
                        pwake++;
        }
-       spin_unlock_irq(&ep->wq.lock);
+       write_unlock_irq(&ep->lock);
 
        if (!ep_locked)
                mutex_unlock(&ep->mtx);
@@ -789,10 +794,10 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi)
 
        rb_erase_cached(&epi->rbn, &ep->rbr);
 
-       spin_lock_irq(&ep->wq.lock);
+       write_lock_irq(&ep->lock);
        if (ep_is_linked(epi))
                list_del_init(&epi->rdllink);
-       spin_unlock_irq(&ep->wq.lock);
+       write_unlock_irq(&ep->lock);
 
        wakeup_source_unregister(ep_wakeup_source(epi));
        /*
@@ -842,7 +847,7 @@ static void ep_free(struct eventpoll *ep)
         * Walks through the whole tree by freeing each "struct epitem". At this
         * point we are sure no poll callbacks will be lingering around, and also by
         * holding "epmutex" we can be sure that no file cleanup code will hit
-        * us during this operation. So we can avoid the lock on "ep->wq.lock".
+        * us during this operation. So we can avoid the lock on "ep->lock".
         * We do not need to lock ep->mtx, either, we only do it to prevent
         * a lockdep warning.
         */
@@ -1023,6 +1028,7 @@ static int ep_alloc(struct eventpoll **pep)
                goto free_uid;
 
        mutex_init(&ep->mtx);
+       rwlock_init(&ep->lock);
        init_waitqueue_head(&ep->wq);
        init_waitqueue_head(&ep->poll_wait);
        INIT_LIST_HEAD(&ep->rdllist);
@@ -1112,21 +1118,107 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd,
 }
 #endif /* CONFIG_CHECKPOINT_RESTORE */
 
+/**
+ * Adds a new entry to the tail of the list in a lockless way, i.e.
+ * multiple CPUs are allowed to call this function concurrently.
+ *
+ * Beware: it is necessary to prevent any other modifications of the
+ *         existing list until all changes are completed, in other words
+ *         concurrent list_add_tail_lockless() calls should be protected
+ *         with a read lock, where write lock acts as a barrier which
+ *         makes sure all list_add_tail_lockless() calls are fully
+ *         completed.
+ *
+ *        Also an element can be locklessly added to the list only in one
+ *        direction i.e. either to the tail either to the head, otherwise
+ *        concurrent access will corrupt the list.
+ *
+ * Returns %false if element has been already added to the list, %true
+ * otherwise.
+ */
+static inline bool list_add_tail_lockless(struct list_head *new,
+                                         struct list_head *head)
+{
+       struct list_head *prev;
+
+       /*
+        * This is simple 'new->next = head' operation, but cmpxchg()
+        * is used in order to detect that same element has been just
+        * added to the list from another CPU: the winner observes
+        * new->next == new.
+        */
+       if (cmpxchg(&new->next, new, head) != new)
+               return false;
+
+       /*
+        * Initially ->next of a new element must be updated with the head
+        * (we are inserting to the tail) and only then pointers are atomically
+        * exchanged.  XCHG guarantees memory ordering, thus ->next should be
+        * updated before pointers are actually swapped and pointers are
+        * swapped before prev->next is updated.
+        */
+
+       prev = xchg(&head->prev, new);
+
+       /*
+        * It is safe to modify prev->next and new->prev, because a new element
+        * is added only to the tail and new->next is updated before XCHG.
+        */
+
+       prev->next = new;
+       new->prev = prev;
+
+       return true;
+}
+
+/**
+ * Chains a new epi entry to the tail of the ep->ovflist in a lockless way,
+ * i.e. multiple CPUs are allowed to call this function concurrently.
+ *
+ * Returns %false if epi element has been already chained, %true otherwise.
+ */
+static inline bool chain_epi_lockless(struct epitem *epi)
+{
+       struct eventpoll *ep = epi->ep;
+
+       /* Check that the same epi has not been just chained from another CPU */
+       if (cmpxchg(&epi->next, EP_UNACTIVE_PTR, NULL) != EP_UNACTIVE_PTR)
+               return false;
+
+       /* Atomically exchange tail */
+       epi->next = xchg(&ep->ovflist, epi);
+
+       return true;
+}
+
 /*
  * This is the callback that is passed to the wait queue wakeup
  * mechanism. It is called by the stored file descriptors when they
  * have events to report.
+ *
+ * This callback takes a read lock in order not to content with concurrent
+ * events from another file descriptors, thus all modifications to ->rdllist
+ * or ->ovflist are lockless.  Read lock is paired with the write lock from
+ * ep_scan_ready_list(), which stops all list modifications and guarantees
+ * that lists state is seen correctly.
+ *
+ * Another thing worth to mention is that ep_poll_callback() can be called
+ * concurrently for the same @epi from different CPUs if poll table was inited
+ * with several wait queues entries.  Plural wakeup from different CPUs of a
+ * single wait queue is serialized by wq.lock, but the case when multiple wait
+ * queues are used should be detected accordingly.  This is detected using
+ * cmpxchg() operation.
  */
 static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key)
 {
        int pwake = 0;
-       unsigned long flags;
        struct epitem *epi = ep_item_from_wait(wait);
        struct eventpoll *ep = epi->ep;
        __poll_t pollflags = key_to_poll(key);
+       unsigned long flags;
        int ewake = 0;
 
-       spin_lock_irqsave(&ep->wq.lock, flags);
+       read_lock_irqsave(&ep->lock, flags);
 
        ep_set_busy_poll_napi_id(epi);
 
@@ -1155,24 +1247,15 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
         * chained in ep->ovflist and requeued later on.
         */
        if (READ_ONCE(ep->ovflist) != EP_UNACTIVE_PTR) {
-               if (epi->next == EP_UNACTIVE_PTR) {
-                       epi->next = READ_ONCE(ep->ovflist);
-                       WRITE_ONCE(ep->ovflist, epi);
-                       if (epi->ws) {
-                               /*
-                                * Activate ep->ws since epi->ws may get
-                                * deactivated at any time.
-                                */
-                               __pm_stay_awake(ep->ws);
-                       }
-
-               }
+               if (epi->next == EP_UNACTIVE_PTR &&
+                   chain_epi_lockless(epi))
+                       ep_pm_stay_awake_rcu(epi);
                goto out_unlock;
        }
 
        /* If this file is already in the ready list we exit soon */
-       if (!ep_is_linked(epi)) {
-               list_add_tail(&epi->rdllink, &ep->rdllist);
+       if (!ep_is_linked(epi) &&
+           list_add_tail_lockless(&epi->rdllink, &ep->rdllist)) {
                ep_pm_stay_awake_rcu(epi);
        }
 
@@ -1197,13 +1280,13 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
                                break;
                        }
                }
-               wake_up_locked(&ep->wq);
+               wake_up(&ep->wq);
        }
        if (waitqueue_active(&ep->poll_wait))
                pwake++;
 
 out_unlock:
-       spin_unlock_irqrestore(&ep->wq.lock, flags);
+       read_unlock_irqrestore(&ep->lock, flags);
 
        /* We have to call this outside the lock */
        if (pwake)
@@ -1488,7 +1571,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
                goto error_remove_epi;
 
        /* We have to drop the new item inside our item list to keep track of it */
-       spin_lock_irq(&ep->wq.lock);
+       write_lock_irq(&ep->lock);
 
        /* record NAPI ID of new item if present */
        ep_set_busy_poll_napi_id(epi);
@@ -1500,12 +1583,12 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
 
                /* Notify waiting tasks that events are available */
                if (waitqueue_active(&ep->wq))
-                       wake_up_locked(&ep->wq);
+                       wake_up(&ep->wq);
                if (waitqueue_active(&ep->poll_wait))
                        pwake++;
        }
 
-       spin_unlock_irq(&ep->wq.lock);
+       write_unlock_irq(&ep->lock);
 
        atomic_long_inc(&ep->user->epoll_watches);
 
@@ -1531,10 +1614,10 @@ error_unregister:
         * list, since that is used/cleaned only inside a section bound by "mtx".
         * And ep_insert() is called with "mtx" held.
         */
-       spin_lock_irq(&ep->wq.lock);
+       write_lock_irq(&ep->lock);
        if (ep_is_linked(epi))
                list_del_init(&epi->rdllink);
-       spin_unlock_irq(&ep->wq.lock);
+       write_unlock_irq(&ep->lock);
 
        wakeup_source_unregister(ep_wakeup_source(epi));
 
@@ -1578,9 +1661,9 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi,
         * 1) Flush epi changes above to other CPUs.  This ensures
         *    we do not miss events from ep_poll_callback if an
         *    event occurs immediately after we call f_op->poll().
-        *    We need this because we did not take ep->wq.lock while
+        *    We need this because we did not take ep->lock while
         *    changing epi above (but ep_poll_callback does take
-        *    ep->wq.lock).
+        *    ep->lock).
         *
         * 2) We also need to ensure we do not miss _past_ events
         *    when calling f_op->poll().  This barrier also
@@ -1599,18 +1682,18 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi,
         * list, push it inside.
         */
        if (ep_item_poll(epi, &pt, 1)) {
-               spin_lock_irq(&ep->wq.lock);
+               write_lock_irq(&ep->lock);
                if (!ep_is_linked(epi)) {
                        list_add_tail(&epi->rdllink, &ep->rdllist);
                        ep_pm_stay_awake(epi);
 
                        /* Notify waiting tasks that events are available */
                        if (waitqueue_active(&ep->wq))
-                               wake_up_locked(&ep->wq);
+                               wake_up(&ep->wq);
                        if (waitqueue_active(&ep->poll_wait))
                                pwake++;
                }
-               spin_unlock_irq(&ep->wq.lock);
+               write_unlock_irq(&ep->lock);
        }
 
        /* We have to call this outside the lock */
@@ -1771,9 +1854,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
                 */
                timed_out = 1;
 
-               spin_lock_irq(&ep->wq.lock);
+               write_lock_irq(&ep->lock);
                eavail = ep_events_available(ep);
-               spin_unlock_irq(&ep->wq.lock);
+               write_unlock_irq(&ep->lock);
 
                goto send_events;
        }
index 74f3672..2e00333 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1563,7 +1563,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
 
 /*
  * Fill the binprm structure from the inode.
- * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
+ * Check permissions, then read the first BINPRM_BUF_SIZE bytes
  *
  * This may be called multiple times for binary chains (scripts for example).
  */
@@ -1944,15 +1944,10 @@ EXPORT_SYMBOL(set_binfmt);
  */
 void set_dumpable(struct mm_struct *mm, int value)
 {
-       unsigned long old, new;
-
        if (WARN_ON((unsigned)value > SUID_DUMP_ROOT))
                return;
 
-       do {
-               old = READ_ONCE(mm->flags);
-               new = (old & ~MMF_DUMPABLE_MASK) | value;
-       } while (cmpxchg(&mm->flags, old, new) != old);
+       set_mask_bits(&mm->flags, MMF_DUMPABLE_MASK, value);
 }
 
 SYSCALL_DEFINE3(execve,
index 13935ee..b3bed32 100644 (file)
@@ -214,6 +214,7 @@ const struct file_operations fat_file_operations = {
 #endif
        .fsync          = fat_file_fsync,
        .splice_read    = generic_file_splice_read,
+       .splice_write   = iter_file_splice_write,
        .fallocate      = fat_fallocate,
 };
 
index 87d7710..0a8c5c2 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/bitops.h>
 #include <linux/init_task.h>
 #include <linux/uaccess.h>
-#include <linux/build_bug.h>
 
 #include "internal.h"
 #include "mount.h"
@@ -131,7 +130,6 @@ getname_flags(const char __user *filename, int flags, int *empty)
        struct filename *result;
        char *kname;
        int len;
-       BUILD_BUG_ON(offsetof(struct filename, iname) % sizeof(long) != 0);
 
        result = audit_reusename(filename);
        if (result)
index 03b4c4f..dca5f24 100644 (file)
@@ -953,9 +953,6 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
 #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
 __printf(3, 4)
 void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...);
-#else
-#define __acpi_handle_debug(descriptor, handle, fmt, ...)              \
-       acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__);
 #endif
 
 /*
@@ -985,12 +982,8 @@ void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const c
 #else
 #if defined(CONFIG_DYNAMIC_DEBUG)
 #define acpi_handle_debug(handle, fmt, ...)                            \
-do {                                                                   \
-       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                 \
-       if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))          \
-               __acpi_handle_debug(&descriptor, handle, pr_fmt(fmt),   \
-                               ##__VA_ARGS__);                         \
-} while (0)
+       _dynamic_func_call(fmt, __acpi_handle_debug,                    \
+                          handle, pr_fmt(fmt), ##__VA_ARGS__)
 #else
 #define acpi_handle_debug(handle, fmt, ...)                            \
 ({                                                                     \
index 705f7c4..602af23 100644 (file)
@@ -246,7 +246,7 @@ static __always_inline void __assign_bit(long nr, volatile unsigned long *addr,
                new__ = (old__ & ~mask__) | bits__;             \
        } while (cmpxchg(ptr, old__, new__) != old__);          \
                                                                \
-       new__;                                                  \
+       old__;                                                  \
 })
 #endif
 
index faeec74..0fe5426 100644 (file)
  */
 #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
 
+/**
+ * static_assert - check integer constant expression at build time
+ *
+ * static_assert() is a wrapper for the C11 _Static_assert, with a
+ * little macro magic to make the message optional (defaulting to the
+ * stringification of the tested expression).
+ *
+ * Contrary to BUILD_BUG_ON(), static_assert() can be used at global
+ * scope, but requires the expression to be an integer constant
+ * expression (i.e., it is not enough that __builtin_constant_p() is
+ * true for expr).
+ *
+ * Also note that BUILD_BUG_ON() fails the build if the condition is
+ * true, while static_assert() fails the build if the expression is
+ * false.
+ */
+#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
+#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
+
 #endif /* _LINUX_BUILD_BUG_H */
index b78bab4..8e68280 100644 (file)
@@ -55,6 +55,7 @@ static inline void ndelay(unsigned long x)
 
 extern unsigned long lpj_fine;
 void calibrate_delay(void);
+void __attribute__((weak)) calibration_delay_done(void);
 void msleep(unsigned int msecs);
 unsigned long msleep_interruptible(unsigned int msecs);
 void usleep_range(unsigned long min, unsigned long max);
index 54b5861..f40f606 100644 (file)
@@ -1568,7 +1568,7 @@ do {                                                                      \
                                      DEFAULT_RATELIMIT_INTERVAL,       \
                                      DEFAULT_RATELIMIT_BURST);         \
        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                 \
-       if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&        \
+       if (DYNAMIC_DEBUG_BRANCH(descriptor) &&                         \
            __ratelimit(&_rs))                                          \
                __dynamic_dev_dbg(&descriptor, dev, dev_fmt(fmt),       \
                                  ##__VA_ARGS__);                       \
index b3419da..c2be029 100644 (file)
@@ -47,10 +47,10 @@ struct _ddebug {
 } __attribute__((aligned(8)));
 
 
-int ddebug_add_module(struct _ddebug *tab, unsigned int n,
-                               const char *modname);
 
 #if defined(CONFIG_DYNAMIC_DEBUG)
+int ddebug_add_module(struct _ddebug *tab, unsigned int n,
+                               const char *modname);
 extern int ddebug_remove_module(const char *mod_name);
 extern __printf(2, 3)
 void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
@@ -71,7 +71,7 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
                          const struct net_device *dev,
                          const char *fmt, ...);
 
-#define DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, key, init)        \
+#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt)               \
        static struct _ddebug  __aligned(8)                     \
        __attribute__((section("__verbose"))) name = {          \
                .modname = KBUILD_MODNAME,                      \
@@ -80,35 +80,27 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
                .format = (fmt),                                \
                .lineno = __LINE__,                             \
                .flags = _DPRINTK_FLAGS_DEFAULT,                \
-               dd_key_init(key, init)                          \
+               _DPRINTK_KEY_INIT                               \
        }
 
 #ifdef CONFIG_JUMP_LABEL
 
-#define dd_key_init(key, init) key = (init)
-
 #ifdef DEBUG
-#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
-       DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, .key.dd_key_true, \
-                                         (STATIC_KEY_TRUE_INIT))
+
+#define _DPRINTK_KEY_INIT .key.dd_key_true = (STATIC_KEY_TRUE_INIT)
 
 #define DYNAMIC_DEBUG_BRANCH(descriptor) \
        static_branch_likely(&descriptor.key.dd_key_true)
 #else
-#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
-       DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, .key.dd_key_false, \
-                                         (STATIC_KEY_FALSE_INIT))
+#define _DPRINTK_KEY_INIT .key.dd_key_false = (STATIC_KEY_FALSE_INIT)
 
 #define DYNAMIC_DEBUG_BRANCH(descriptor) \
        static_branch_unlikely(&descriptor.key.dd_key_false)
 #endif
 
-#else
+#else /* !HAVE_JUMP_LABEL */
 
-#define dd_key_init(key, init)
-
-#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
-       DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
+#define _DPRINTK_KEY_INIT
 
 #ifdef DEBUG
 #define DYNAMIC_DEBUG_BRANCH(descriptor) \
@@ -120,46 +112,66 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
 
 #endif
 
-#define dynamic_pr_debug(fmt, ...)                             \
-do {                                                           \
-       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);         \
-       if (DYNAMIC_DEBUG_BRANCH(descriptor))                   \
-               __dynamic_pr_debug(&descriptor, pr_fmt(fmt),    \
-                                  ##__VA_ARGS__);              \
+#define __dynamic_func_call(id, fmt, func, ...) do {   \
+       DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt);         \
+       if (DYNAMIC_DEBUG_BRANCH(id))                   \
+               func(&id, ##__VA_ARGS__);               \
 } while (0)
 
-#define dynamic_dev_dbg(dev, fmt, ...)                         \
-do {                                                           \
-       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);         \
-       if (DYNAMIC_DEBUG_BRANCH(descriptor))                   \
-               __dynamic_dev_dbg(&descriptor, dev, fmt,        \
-                                 ##__VA_ARGS__);               \
+#define __dynamic_func_call_no_desc(id, fmt, func, ...) do {   \
+       DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt);                 \
+       if (DYNAMIC_DEBUG_BRANCH(id))                           \
+               func(__VA_ARGS__);                              \
 } while (0)
 
+/*
+ * "Factory macro" for generating a call to func, guarded by a
+ * DYNAMIC_DEBUG_BRANCH. The dynamic debug decriptor will be
+ * initialized using the fmt argument. The function will be called with
+ * the address of the descriptor as first argument, followed by all
+ * the varargs. Note that fmt is repeated in invocations of this
+ * macro.
+ */
+#define _dynamic_func_call(fmt, func, ...)                             \
+       __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
+/*
+ * A variant that does the same, except that the descriptor is not
+ * passed as the first argument to the function; it is only called
+ * with precisely the macro's varargs.
+ */
+#define _dynamic_func_call_no_desc(fmt, func, ...)     \
+       __dynamic_func_call_no_desc(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
+
+#define dynamic_pr_debug(fmt, ...)                             \
+       _dynamic_func_call(fmt, __dynamic_pr_debug,             \
+                          pr_fmt(fmt), ##__VA_ARGS__)
+
+#define dynamic_dev_dbg(dev, fmt, ...)                         \
+       _dynamic_func_call(fmt,__dynamic_dev_dbg,               \
+                          dev, fmt, ##__VA_ARGS__)
+
 #define dynamic_netdev_dbg(dev, fmt, ...)                      \
-do {                                                           \
-       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);         \
-       if (DYNAMIC_DEBUG_BRANCH(descriptor))                   \
-               __dynamic_netdev_dbg(&descriptor, dev, fmt,     \
-                                    ##__VA_ARGS__);            \
-} while (0)
+       _dynamic_func_call(fmt, __dynamic_netdev_dbg,           \
+                          dev, fmt, ##__VA_ARGS__)
 
-#define dynamic_hex_dump(prefix_str, prefix_type, rowsize,     \
-                        groupsize, buf, len, ascii)            \
-do {                                                           \
-       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor,               \
-               __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
-       if (DYNAMIC_DEBUG_BRANCH(descriptor))                   \
-               print_hex_dump(KERN_DEBUG, prefix_str,          \
-                              prefix_type, rowsize, groupsize, \
-                              buf, len, ascii);                \
-} while (0)
+#define dynamic_hex_dump(prefix_str, prefix_type, rowsize,             \
+                        groupsize, buf, len, ascii)                    \
+       _dynamic_func_call_no_desc(__builtin_constant_p(prefix_str) ? prefix_str : "hexdump", \
+                                  print_hex_dump,                      \
+                                  KERN_DEBUG, prefix_str, prefix_type, \
+                                  rowsize, groupsize, buf, len, ascii)
 
 #else
 
 #include <linux/string.h>
 #include <linux/errno.h>
 
+static inline int ddebug_add_module(struct _ddebug *tab, unsigned int n,
+                                   const char *modname)
+{
+       return 0;
+}
+
 static inline int ddebug_remove_module(const char *mod)
 {
        return 0;
index 4ede9ff..2cc5408 100644 (file)
@@ -38,6 +38,8 @@
 #include <linux/errseq.h>
 #include <linux/ioprio.h>
 #include <linux/fs_types.h>
+#include <linux/build_bug.h>
+#include <linux/stddef.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -2478,6 +2480,7 @@ struct filename {
        struct audit_names      *aname;
        const char              iname[];
 };
+static_assert(offsetof(struct filename, iname) % sizeof(long) == 0);
 
 extern long vfs_truncate(const struct path *, loff_t);
 extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
index a8868a3..34a5036 100644 (file)
@@ -4,6 +4,7 @@
 
 
 #include <stdarg.h>
+#include <linux/limits.h>
 #include <linux/linkage.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <linux/printk.h>
 #include <linux/build_bug.h>
 #include <asm/byteorder.h>
+#include <asm/div64.h>
 #include <uapi/linux/kernel.h>
 
-#define USHRT_MAX      ((u16)(~0U))
-#define SHRT_MAX       ((s16)(USHRT_MAX>>1))
-#define SHRT_MIN       ((s16)(-SHRT_MAX - 1))
-#define INT_MAX                ((int)(~0U>>1))
-#define INT_MIN                (-INT_MAX - 1)
-#define UINT_MAX       (~0U)
-#define LONG_MAX       ((long)(~0UL>>1))
-#define LONG_MIN       (-LONG_MAX - 1)
-#define ULONG_MAX      (~0UL)
-#define LLONG_MAX      ((long long)(~0ULL>>1))
-#define LLONG_MIN      (-LLONG_MAX - 1)
-#define ULLONG_MAX     (~0ULL)
-#define SIZE_MAX       (~(size_t)0)
-#define PHYS_ADDR_MAX  (~(phys_addr_t)0)
-
-#define U8_MAX         ((u8)~0U)
-#define S8_MAX         ((s8)(U8_MAX>>1))
-#define S8_MIN         ((s8)(-S8_MAX - 1))
-#define U16_MAX                ((u16)~0U)
-#define S16_MAX                ((s16)(U16_MAX>>1))
-#define S16_MIN                ((s16)(-S16_MAX - 1))
-#define U32_MAX                ((u32)~0U)
-#define S32_MAX                ((s32)(U32_MAX>>1))
-#define S32_MIN                ((s32)(-S32_MAX - 1))
-#define U64_MAX                ((u64)~0ULL)
-#define S64_MAX                ((s64)(U64_MAX>>1))
-#define S64_MIN                ((s64)(-S64_MAX - 1))
-
 #define STACK_MAGIC    0xdeadbeef
 
 /**
  *
  * Rounds @x up to next multiple of @y. If @y will always be a power
  * of 2, consider using the faster round_up().
- *
- * The `const' here prevents gcc-3.3 from calling __divdi3
  */
 #define roundup(x, y) (                                        \
 {                                                      \
-       const typeof(y) __y = y;                        \
+       typeof(y) __y = y;                              \
        (((x) + (__y - 1)) / __y) * __y;                \
 }                                                      \
 )
 #define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
 
 #ifdef CONFIG_LBDAF
-# include <asm/div64.h>
 # define sector_div(a, b) do_div(a, b)
 #else
 # define sector_div(n, b)( \
diff --git a/include/linux/limits.h b/include/linux/limits.h
new file mode 100644 (file)
index 0000000..76afcd2
--- /dev/null
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_LIMITS_H
+#define _LINUX_LIMITS_H
+
+#include <uapi/linux/limits.h>
+#include <linux/types.h>
+
+#define USHRT_MAX      ((unsigned short)~0U)
+#define SHRT_MAX       ((short)(USHRT_MAX >> 1))
+#define SHRT_MIN       ((short)(-SHRT_MAX - 1))
+#define INT_MAX                ((int)(~0U >> 1))
+#define INT_MIN                (-INT_MAX - 1)
+#define UINT_MAX       (~0U)
+#define LONG_MAX       ((long)(~0UL >> 1))
+#define LONG_MIN       (-LONG_MAX - 1)
+#define ULONG_MAX      (~0UL)
+#define LLONG_MAX      ((long long)(~0ULL >> 1))
+#define LLONG_MIN      (-LLONG_MAX - 1)
+#define ULLONG_MAX     (~0ULL)
+#define SIZE_MAX       (~(size_t)0)
+#define PHYS_ADDR_MAX  (~(phys_addr_t)0)
+
+#define U8_MAX         ((u8)~0U)
+#define S8_MAX         ((s8)(U8_MAX >> 1))
+#define S8_MIN         ((s8)(-S8_MAX - 1))
+#define U16_MAX                ((u16)~0U)
+#define S16_MAX                ((s16)(U16_MAX >> 1))
+#define S16_MIN                ((s16)(-S16_MAX - 1))
+#define U32_MAX                ((u32)~0U)
+#define S32_MAX                ((s32)(U32_MAX >> 1))
+#define S32_MIN                ((s32)(-S32_MAX - 1))
+#define U64_MAX                ((u64)~0ULL)
+#define S64_MAX                ((s64)(U64_MAX >> 1))
+#define S64_MIN                ((s64)(-S64_MAX - 1))
+
+#endif /* _LINUX_LIMITS_H */
index 2ae27cb..e95c7d1 100644 (file)
 #define LZO1X_1_MEM_COMPRESS   (8192 * sizeof(unsigned short))
 #define LZO1X_MEM_COMPRESS     LZO1X_1_MEM_COMPRESS
 
-#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
+#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3 + 2)
 
 /* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */
 int lzo1x_1_compress(const unsigned char *src, size_t src_len,
                     unsigned char *dst, size_t *dst_len, void *wrkmem);
 
+/* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */
+int lzorle1x_1_compress(const unsigned char *src, size_t src_len,
+                    unsigned char *dst, size_t *dst_len, void *wrkmem);
+
 /* safe decompression with overrun testing */
 int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
                          unsigned char *dst, size_t *dst_len);
index 20ec56f..5801ee8 100644 (file)
@@ -1323,52 +1323,6 @@ static inline void clear_page_pfmemalloc(struct page *page)
 }
 
 /*
- * Different kinds of faults, as returned by handle_mm_fault().
- * Used to decide whether a process gets delivered SIGBUS or
- * just gets major/minor fault counters bumped up.
- */
-
-#define VM_FAULT_OOM   0x0001
-#define VM_FAULT_SIGBUS        0x0002
-#define VM_FAULT_MAJOR 0x0004
-#define VM_FAULT_WRITE 0x0008  /* Special case for get_user_pages */
-#define VM_FAULT_HWPOISON 0x0010       /* Hit poisoned small page */
-#define VM_FAULT_HWPOISON_LARGE 0x0020  /* Hit poisoned large page. Index encoded in upper bits */
-#define VM_FAULT_SIGSEGV 0x0040
-
-#define VM_FAULT_NOPAGE        0x0100  /* ->fault installed the pte, not return page */
-#define VM_FAULT_LOCKED        0x0200  /* ->fault locked the returned page */
-#define VM_FAULT_RETRY 0x0400  /* ->fault blocked, must retry */
-#define VM_FAULT_FALLBACK 0x0800       /* huge page fault failed, fall back to small */
-#define VM_FAULT_DONE_COW   0x1000     /* ->fault has fully handled COW */
-#define VM_FAULT_NEEDDSYNC  0x2000     /* ->fault did not modify page tables
-                                        * and needs fsync() to complete (for
-                                        * synchronous page faults in DAX) */
-
-#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \
-                        VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \
-                        VM_FAULT_FALLBACK)
-
-#define VM_FAULT_RESULT_TRACE \
-       { VM_FAULT_OOM,                 "OOM" }, \
-       { VM_FAULT_SIGBUS,              "SIGBUS" }, \
-       { VM_FAULT_MAJOR,               "MAJOR" }, \
-       { VM_FAULT_WRITE,               "WRITE" }, \
-       { VM_FAULT_HWPOISON,            "HWPOISON" }, \
-       { VM_FAULT_HWPOISON_LARGE,      "HWPOISON_LARGE" }, \
-       { VM_FAULT_SIGSEGV,             "SIGSEGV" }, \
-       { VM_FAULT_NOPAGE,              "NOPAGE" }, \
-       { VM_FAULT_LOCKED,              "LOCKED" }, \
-       { VM_FAULT_RETRY,               "RETRY" }, \
-       { VM_FAULT_FALLBACK,            "FALLBACK" }, \
-       { VM_FAULT_DONE_COW,            "DONE_COW" }, \
-       { VM_FAULT_NEEDDSYNC,           "NEEDDSYNC" }
-
-/* Encode hstate index for a hwpoisoned large page */
-#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
-#define VM_FAULT_GET_HINDEX(x) (((x) >> 12) & 0xf)
-
-/*
  * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
  */
 extern void pagefault_out_of_memory(void);
index ab9b484..86e7a7a 100644 (file)
@@ -22,7 +22,6 @@
 #endif
 #define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
 
-typedef int vm_fault_t;
 
 struct address_space;
 struct mem_cgroup;
@@ -621,6 +620,78 @@ static inline bool mm_tlb_flush_nested(struct mm_struct *mm)
 
 struct vm_fault;
 
+/**
+ * typedef vm_fault_t - Return type for page fault handlers.
+ *
+ * Page fault handlers return a bitmask of %VM_FAULT values.
+ */
+typedef __bitwise unsigned int vm_fault_t;
+
+/**
+ * enum vm_fault_reason - Page fault handlers return a bitmask of
+ * these values to tell the core VM what happened when handling the
+ * fault. Used to decide whether a process gets delivered SIGBUS or
+ * just gets major/minor fault counters bumped up.
+ *
+ * @VM_FAULT_OOM:              Out Of Memory
+ * @VM_FAULT_SIGBUS:           Bad access
+ * @VM_FAULT_MAJOR:            Page read from storage
+ * @VM_FAULT_WRITE:            Special case for get_user_pages
+ * @VM_FAULT_HWPOISON:         Hit poisoned small page
+ * @VM_FAULT_HWPOISON_LARGE:   Hit poisoned large page. Index encoded
+ *                             in upper bits
+ * @VM_FAULT_SIGSEGV:          segmentation fault
+ * @VM_FAULT_NOPAGE:           ->fault installed the pte, not return page
+ * @VM_FAULT_LOCKED:           ->fault locked the returned page
+ * @VM_FAULT_RETRY:            ->fault blocked, must retry
+ * @VM_FAULT_FALLBACK:         huge page fault failed, fall back to small
+ * @VM_FAULT_DONE_COW:         ->fault has fully handled COW
+ * @VM_FAULT_NEEDDSYNC:                ->fault did not modify page tables and needs
+ *                             fsync() to complete (for synchronous page faults
+ *                             in DAX)
+ * @VM_FAULT_HINDEX_MASK:      mask HINDEX value
+ *
+ */
+enum vm_fault_reason {
+       VM_FAULT_OOM            = (__force vm_fault_t)0x000001,
+       VM_FAULT_SIGBUS         = (__force vm_fault_t)0x000002,
+       VM_FAULT_MAJOR          = (__force vm_fault_t)0x000004,
+       VM_FAULT_WRITE          = (__force vm_fault_t)0x000008,
+       VM_FAULT_HWPOISON       = (__force vm_fault_t)0x000010,
+       VM_FAULT_HWPOISON_LARGE = (__force vm_fault_t)0x000020,
+       VM_FAULT_SIGSEGV        = (__force vm_fault_t)0x000040,
+       VM_FAULT_NOPAGE         = (__force vm_fault_t)0x000100,
+       VM_FAULT_LOCKED         = (__force vm_fault_t)0x000200,
+       VM_FAULT_RETRY          = (__force vm_fault_t)0x000400,
+       VM_FAULT_FALLBACK       = (__force vm_fault_t)0x000800,
+       VM_FAULT_DONE_COW       = (__force vm_fault_t)0x001000,
+       VM_FAULT_NEEDDSYNC      = (__force vm_fault_t)0x002000,
+       VM_FAULT_HINDEX_MASK    = (__force vm_fault_t)0x0f0000,
+};
+
+/* Encode hstate index for a hwpoisoned large page */
+#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))
+#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf)
+
+#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS |       \
+                       VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON |  \
+                       VM_FAULT_HWPOISON_LARGE | VM_FAULT_FALLBACK)
+
+#define VM_FAULT_RESULT_TRACE \
+       { VM_FAULT_OOM,                 "OOM" },        \
+       { VM_FAULT_SIGBUS,              "SIGBUS" },     \
+       { VM_FAULT_MAJOR,               "MAJOR" },      \
+       { VM_FAULT_WRITE,               "WRITE" },      \
+       { VM_FAULT_HWPOISON,            "HWPOISON" },   \
+       { VM_FAULT_HWPOISON_LARGE,      "HWPOISON_LARGE" },     \
+       { VM_FAULT_SIGSEGV,             "SIGSEGV" },    \
+       { VM_FAULT_NOPAGE,              "NOPAGE" },     \
+       { VM_FAULT_LOCKED,              "LOCKED" },     \
+       { VM_FAULT_RETRY,               "RETRY" },      \
+       { VM_FAULT_FALLBACK,            "FALLBACK" },   \
+       { VM_FAULT_DONE_COW,            "DONE_COW" },   \
+       { VM_FAULT_NEEDDSYNC,           "NEEDDSYNC" }
+
 struct vm_special_mapping {
        const char *name;       /* The name, e.g. "[vdso]". */
 
index e093067..651fca7 100644 (file)
@@ -263,7 +263,7 @@ do {                                                                \
 #define net_dbg_ratelimited(fmt, ...)                                  \
 do {                                                                   \
        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                 \
-       if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&        \
+       if (DYNAMIC_DEBUG_BRANCH(descriptor) &&                         \
            net_ratelimit())                                            \
                __dynamic_pr_debug(&descriptor, pr_fmt(fmt),            \
                                   ##__VA_ARGS__);                      \
index 14a9a39..b6f4ba1 100644 (file)
@@ -109,7 +109,6 @@ extern struct pid *find_vpid(int nr);
  */
 extern struct pid *find_get_pid(int nr);
 extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
-int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
 
 extern struct pid *alloc_pid(struct pid_namespace *ns);
 extern void free_pid(struct pid *pid);
index 77740a5..02b5c11 100644 (file)
@@ -461,7 +461,7 @@ do {                                                                        \
                                      DEFAULT_RATELIMIT_INTERVAL,       \
                                      DEFAULT_RATELIMIT_BURST);         \
        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt));         \
-       if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&        \
+       if (DYNAMIC_DEBUG_BRANCH(descriptor) &&                         \
            __ratelimit(&_rs))                                          \
                __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__);    \
 } while (0)
index e1bdf01..c759f96 100644 (file)
@@ -66,7 +66,7 @@ struct rchan
        struct kref kref;               /* channel refcount */
        void *private_data;             /* for user-defined data */
        size_t last_toobig;             /* tried to log event > subbuf size */
-       struct rchan_buf ** __percpu buf; /* per-cpu channel buffers */
+       struct rchan_buf * __percpu *buf; /* per-cpu channel buffers */
        int is_global;                  /* One global buffer ? */
        struct list_head list;          /* for channel list */
        struct dentry *parent;          /* parent dentry passed to open */
index c2615d6..cc0dbbe 100644 (file)
@@ -155,9 +155,9 @@ typedef u64 dma_addr_t;
 typedef u32 dma_addr_t;
 #endif
 
-typedef unsigned __bitwise gfp_t;
-typedef unsigned __bitwise slab_flags_t;
-typedef unsigned __bitwise fmode_t;
+typedef unsigned int __bitwise gfp_t;
+typedef unsigned int __bitwise slab_flags_t;
+typedef unsigned int __bitwise fmode_t;
 
 #ifdef CONFIG_PHYS_ADDR_T_64BIT
 typedef u64 phys_addr_t;
index 0821196..1f7925a 100644 (file)
@@ -23,7 +23,7 @@
 #define AUTOFS_MIN_PROTO_VERSION       3
 #define AUTOFS_MAX_PROTO_VERSION       5
 
-#define AUTOFS_PROTO_SUBVERSION                4
+#define AUTOFS_PROTO_SUBVERSION                5
 
 /*
  * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
index 4abad03..689025d 100644 (file)
@@ -16,6 +16,6 @@ struct pt_regs;
 #define MAX_ARG_STRINGS 0x7FFFFFFF
 
 /* sizeof(linux_binprm->buf) */
-#define BINPRM_BUF_SIZE 128
+#define BINPRM_BUF_SIZE 256
 
 #endif /* _UAPI_LINUX_BINFMTS_H */
index c3547f0..6bcbe30 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _LINUX_LIMITS_H
-#define _LINUX_LIMITS_H
+#ifndef _UAPI_LINUX_LIMITS_H
+#define _UAPI_LINUX_LIMITS_H
 
 #define NR_OPEN                1024
 
index fca8996..4749e11 100644 (file)
@@ -431,7 +431,7 @@ static long __init flush_buffer(void *bufv, unsigned long len)
                        len -= written;
                        state = Reset;
                } else
-                       error("junk in compressed archive");
+                       error("junk within compressed archive");
        }
        return origLen;
 }
@@ -488,9 +488,9 @@ static char * __init unpack_to_rootfs(char *buf, unsigned long len)
                                message = msg_buf;
                        }
                } else
-                       error("junk in compressed archive");
+                       error("invalid magic at start of compressed archive");
                if (state != Reset)
-                       error("junk in compressed archive");
+                       error("junk at the end of compressed archive");
                this_header = saved_offset + my_inptr;
                buf += my_inptr;
                len -= my_inptr;
index 8090946..7da4504 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -488,18 +488,14 @@ static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s)
 static struct sem_array *sem_alloc(size_t nsems)
 {
        struct sem_array *sma;
-       size_t size;
 
        if (nsems > (INT_MAX - sizeof(*sma)) / sizeof(sma->sems[0]))
                return NULL;
 
-       size = sizeof(*sma) + nsems * sizeof(sma->sems[0]);
-       sma = kvmalloc(size, GFP_KERNEL);
+       sma = kvzalloc(struct_size(sma, sems, nsems), GFP_KERNEL);
        if (unlikely(!sma))
                return NULL;
 
-       memset(sma, 0, size);
-
        return sma;
 }
 
@@ -1680,6 +1676,7 @@ static long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg, int v
        case IPC_SET:
                if (copy_semid_from_user(&semid64, p, version))
                        return -EFAULT;
+               /* fall through */
        case IPC_RMID:
                return semctl_down(ns, semid, cmd, &semid64);
        default:
index b3097bd..6e69910 100644 (file)
@@ -1,7 +1,5 @@
 #
 # Generated files
 #
-config_data.h
-config_data.gz
 timeconst.h
 hz.bc
index 6aa7543..6c57e78 100644 (file)
@@ -116,17 +116,8 @@ obj-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak.o
 KASAN_SANITIZE_stackleak.o := n
 KCOV_INSTRUMENT_stackleak.o := n
 
-$(obj)/configs.o: $(obj)/config_data.h
+$(obj)/configs.o: $(obj)/config_data.gz
 
 targets += config_data.gz
 $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
        $(call if_changed,gzip)
-
-filechk_ikconfiggz = \
-       echo "static const char kernel_config_data[] __used = MAGIC_START"; \
-       cat $< | scripts/bin2c; \
-       echo "MAGIC_END;"
-
-targets += config_data.h
-$(obj)/config_data.h: $(obj)/config_data.gz FORCE
-       $(call filechk,ikconfiggz)
index 2df132b..b062425 100644 (file)
 #include <linux/init.h>
 #include <linux/uaccess.h>
 
-/**************************************************/
-/* the actual current config file                 */
-
 /*
- * Define kernel_config_data and kernel_config_data_size, which contains the
- * wrapped and compressed configuration file.  The file is first compressed
- * with gzip and then bounded by two eight byte magic numbers to allow
- * extraction from a binary kernel image:
- *
- *   IKCFG_ST
- *   <image>
- *   IKCFG_ED
+ * "IKCFG_ST" and "IKCFG_ED" are used to extract the config data from
+ * a binary kernel image or a module. See scripts/extract-ikconfig.
  */
-#define MAGIC_START    "IKCFG_ST"
-#define MAGIC_END      "IKCFG_ED"
-#include "config_data.h"
-
-
-#define MAGIC_SIZE (sizeof(MAGIC_START) - 1)
-#define kernel_config_data_size \
-       (sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)
+asm (
+"      .pushsection .rodata, \"a\"             \n"
+"      .ascii \"IKCFG_ST\"                     \n"
+"      .global kernel_config_data              \n"
+"kernel_config_data:                           \n"
+"      .incbin \"kernel/config_data.gz\"       \n"
+"      .global kernel_config_data_end          \n"
+"kernel_config_data_end:                       \n"
+"      .ascii \"IKCFG_ED\"                     \n"
+"      .popsection                             \n"
+);
 
 #ifdef CONFIG_IKCONFIG_PROC
 
+extern char kernel_config_data;
+extern char kernel_config_data_end;
+
 static ssize_t
 ikconfig_read_current(struct file *file, char __user *buf,
                      size_t len, loff_t * offset)
 {
        return simple_read_from_buffer(buf, len, offset,
-                                      kernel_config_data + MAGIC_SIZE,
-                                      kernel_config_data_size);
+                                      &kernel_config_data,
+                                      &kernel_config_data_end -
+                                      &kernel_config_data);
 }
 
 static const struct file_operations ikconfig_file_ops = {
@@ -79,7 +77,7 @@ static int __init ikconfig_init(void)
        if (!entry)
                return -ENOMEM;
 
-       proc_set_size(entry, kernel_config_data_size);
+       proc_set_size(entry, &kernel_config_data_end - &kernel_config_data);
 
        return 0;
 }
index 77059b2..874e48c 100644 (file)
@@ -77,7 +77,6 @@
 #include <linux/blkdev.h>
 #include <linux/fs_struct.h>
 #include <linux/magic.h>
-#include <linux/sched/mm.h>
 #include <linux/perf_event.h>
 #include <linux/posix-timers.h>
 #include <linux/user-return-notifier.h>
index 1e32e66..2dddecb 100644 (file)
@@ -245,8 +245,7 @@ struct gcov_info *gcov_info_dup(struct gcov_info *info)
 
        /* Duplicate gcov_info. */
        active = num_counter_active(info);
-       dup = kzalloc(sizeof(struct gcov_info) +
-                     sizeof(struct gcov_ctr_info) * active, GFP_KERNEL);
+       dup = kzalloc(struct_size(dup, counts, active), GFP_KERNEL);
        if (!dup)
                return NULL;
        dup->version            = info->version;
@@ -364,8 +363,7 @@ struct gcov_iterator *gcov_iter_new(struct gcov_info *info)
 {
        struct gcov_iterator *iter;
 
-       iter = kzalloc(sizeof(struct gcov_iterator) +
-                      num_counter_active(info) * sizeof(struct type_info),
+       iter = kzalloc(struct_size(iter, type_info, num_counter_active(info)),
                       GFP_KERNEL);
        if (iter)
                iter->info = info;
index 4a91916..f108a95 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/utsname.h>
 #include <linux/sched/signal.h>
 #include <linux/sched/debug.h>
+#include <linux/sched/sysctl.h>
 
 #include <trace/events/sched.h>
 
@@ -126,7 +127,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
                if (sysctl_hung_task_warnings > 0)
                        sysctl_hung_task_warnings--;
                pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
-                       t->comm, t->pid, timeout);
+                      t->comm, t->pid, (jiffies - t->last_switch_time) / HZ);
                pr_err("      %s %s %.*s\n",
                        print_tainted(), init_utsname()->release,
                        (int)strcspn(init_utsname()->version, " "),
index c2277db..2ee3872 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/kcov.h>
+#include <linux/refcount.h>
 #include <asm/setup.h>
 
 /* Number of 64-bit words written per one comparison: */
@@ -44,7 +45,7 @@ struct kcov {
         *  - opened file descriptor
         *  - task with enabled coverage (we can't unwire it from another task)
         */
-       atomic_t                refcount;
+       refcount_t              refcount;
        /* The lock protects mode, size, area and t. */
        spinlock_t              lock;
        enum kcov_mode          mode;
@@ -228,12 +229,12 @@ EXPORT_SYMBOL(__sanitizer_cov_trace_switch);
 
 static void kcov_get(struct kcov *kcov)
 {
-       atomic_inc(&kcov->refcount);
+       refcount_inc(&kcov->refcount);
 }
 
 static void kcov_put(struct kcov *kcov)
 {
-       if (atomic_dec_and_test(&kcov->refcount)) {
+       if (refcount_dec_and_test(&kcov->refcount)) {
                vfree(kcov->area);
                kfree(kcov);
        }
@@ -312,7 +313,7 @@ static int kcov_open(struct inode *inode, struct file *filep)
        if (!kcov)
                return -ENOMEM;
        kcov->mode = KCOV_MODE_DISABLED;
-       atomic_set(&kcov->refcount, 1);
+       refcount_set(&kcov->refcount, 1);
        spin_lock_init(&kcov->lock);
        filep->private_data = kcov;
        return nonseekable_open(inode, filep);
@@ -444,10 +445,8 @@ static int __init kcov_init(void)
         * there is no need to protect it against removal races. The
         * use of debugfs_create_file_unsafe() is actually safe here.
         */
-       if (!debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops)) {
-               pr_err("failed to create kcov in debugfs\n");
-               return -ENOMEM;
-       }
+       debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops);
+
        return 0;
 }
 
index 2ad1b52..0b9aa8a 100644 (file)
@@ -2719,11 +2719,7 @@ static void dynamic_debug_setup(struct module *mod, struct _ddebug *debug, unsig
 {
        if (!debug)
                return;
-#ifdef CONFIG_DYNAMIC_DEBUG
-       if (ddebug_add_module(debug, num, mod->name))
-               pr_err("dynamic debug error adding module: %s\n",
-                       debug->modname);
-#endif
+       ddebug_add_module(debug, num, mod->name);
 }
 
 static void dynamic_debug_remove(struct module *mod, struct _ddebug *debug)
index f121e6b..0ae0d73 100644 (file)
@@ -642,16 +642,14 @@ static int clear_warn_once_set(void *data, u64 val)
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(clear_warn_once_fops,
-                       NULL,
-                       clear_warn_once_set,
-                       "%lld\n");
+DEFINE_DEBUGFS_ATTRIBUTE(clear_warn_once_fops, NULL, clear_warn_once_set,
+                        "%lld\n");
 
 static __init int register_warn_debugfs(void)
 {
        /* Don't care about failure */
-       debugfs_create_file("clear_warn_once", 0200, NULL,
-                           NULL, &clear_warn_once_fops);
+       debugfs_create_file_unsafe("clear_warn_once", 0200, NULL, NULL,
+                                  &clear_warn_once_fops);
        return 0;
 }
 
index c5f8750..12df0e5 100644 (file)
@@ -1747,6 +1747,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
 
                if (who == RUSAGE_CHILDREN)
                        break;
+               /* fall through */
 
        case RUSAGE_SELF:
                thread_group_cputime_adjusted(p, &tgutime, &tgstime);
index 14f30b4..3fb1405 100644 (file)
@@ -67,6 +67,8 @@
 #include <linux/bpf.h>
 #include <linux/mount.h>
 
+#include "../lib/kstrtox.h"
+
 #include <linux/uaccess.h>
 #include <asm/processor.h>
 
@@ -127,6 +129,7 @@ static int __maybe_unused one = 1;
 static int __maybe_unused two = 2;
 static int __maybe_unused four = 4;
 static unsigned long one_ul = 1;
+static unsigned long long_max = LONG_MAX;
 static int one_hundred = 100;
 static int one_thousand = 1000;
 #ifdef CONFIG_PRINTK
@@ -1747,6 +1750,8 @@ static struct ctl_table fs_table[] = {
                .maxlen         = sizeof(files_stat.max_files),
                .mode           = 0644,
                .proc_handler   = proc_doulongvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &long_max,
        },
        {
                .procname       = "nr_open",
@@ -2117,6 +2122,41 @@ static void proc_skip_char(char **buf, size_t *size, const char v)
        }
 }
 
+/**
+ * strtoul_lenient - parse an ASCII formatted integer from a buffer and only
+ *                   fail on overflow
+ *
+ * @cp: kernel buffer containing the string to parse
+ * @endp: pointer to store the trailing characters
+ * @base: the base to use
+ * @res: where the parsed integer will be stored
+ *
+ * In case of success 0 is returned and @res will contain the parsed integer,
+ * @endp will hold any trailing characters.
+ * This function will fail the parse on overflow. If there wasn't an overflow
+ * the function will defer the decision what characters count as invalid to the
+ * caller.
+ */
+static int strtoul_lenient(const char *cp, char **endp, unsigned int base,
+                          unsigned long *res)
+{
+       unsigned long long result;
+       unsigned int rv;
+
+       cp = _parse_integer_fixup_radix(cp, &base);
+       rv = _parse_integer(cp, base, &result);
+       if ((rv & KSTRTOX_OVERFLOW) || (result != (unsigned long)result))
+               return -ERANGE;
+
+       cp += rv;
+
+       if (endp)
+               *endp = (char *)cp;
+
+       *res = (unsigned long)result;
+       return 0;
+}
+
 #define TMPBUFLEN 22
 /**
  * proc_get_long - reads an ASCII formatted integer from a user buffer
@@ -2160,7 +2200,8 @@ static int proc_get_long(char **buf, size_t *size,
        if (!isdigit(*p))
                return -EINVAL;
 
-       *val = simple_strtoul(p, &p, 0);
+       if (strtoul_lenient(p, &p, 0, val))
+               return -EINVAL;
 
        len = p - tmp;
 
index 69bd808..7abbeed 100644 (file)
@@ -920,6 +920,16 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task)
  * CONTEXT:
  * spin_lock_irq(rq->lock)
  *
+ * This function is called during schedule() when a kworker is going
+ * to sleep. It's used by psi to identify aggregation workers during
+ * dequeuing, to allow periodic aggregation to shut-off when that
+ * worker is the last task in the system or cgroup to go to sleep.
+ *
+ * As this function doesn't involve any workqueue-related locking, it
+ * only returns stable values when called from inside the scheduler's
+ * queuing and dequeuing paths, when @task, which must be a kworker,
+ * is guaranteed to not be processing any works.
+ *
  * Return:
  * The last work function %current executed as a worker, NULL if it
  * hasn't executed any work yet.
index 98fa559..a2ae4a8 100644 (file)
@@ -27,15 +27,19 @@ config UBSAN_SANITIZE_ALL
          Enabling this option will get kernel image size increased
          significantly.
 
-config UBSAN_ALIGNMENT
-       bool "Enable checking of pointers alignment"
+config UBSAN_NO_ALIGNMENT
+       bool "Disable checking of pointers alignment"
        depends on UBSAN
-       default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS
+       default y if HAVE_EFFICIENT_UNALIGNED_ACCESS
        help
-         This option enables detection of unaligned memory accesses.
-         Enabling this option on architectures that support unaligned
+         This option disables the check of unaligned memory accesses.
+         This option should be used when building allmodconfig.
+         Disabling this option on architectures that support unaligned
          accesses may produce a lot of false positives.
 
+config UBSAN_ALIGNMENT
+       def_bool !UBSAN_NO_ALIGNMENT
+
 config TEST_UBSAN
        tristate "Module for testing for undefined behavior detection"
        depends on m && UBSAN
index 59875eb..edc3c14 100644 (file)
@@ -1117,6 +1117,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
                                                index_key))
                                goto found_leaf;
                }
+               /* fall through */
        case assoc_array_walk_tree_empty:
        case assoc_array_walk_found_wrong_shortcut:
        default:
index 01c8602..ee146bb 100644 (file)
@@ -109,7 +109,7 @@ u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
                quot = div_u64_rem(dividend, divisor, &rem32);
                *remainder = rem32;
        } else {
-               int n = 1 + fls(high);
+               int n = fls(high);
                quot = div_u64(dividend >> n, divisor >> n);
 
                if (quot != 0)
@@ -147,7 +147,7 @@ u64 div64_u64(u64 dividend, u64 divisor)
        if (high == 0) {
                quot = div_u64(dividend, divisor);
        } else {
-               int n = 1 + fls(high);
+               int n = fls(high);
                quot = div_u64(dividend >> n, divisor >> n);
 
                if (quot != 0)
index dbf2b45..7bdf98c 100644 (file)
@@ -847,17 +847,19 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
                             const char *name)
 {
        struct ddebug_table *dt;
-       const char *new_name;
 
        dt = kzalloc(sizeof(*dt), GFP_KERNEL);
-       if (dt == NULL)
-               return -ENOMEM;
-       new_name = kstrdup_const(name, GFP_KERNEL);
-       if (new_name == NULL) {
-               kfree(dt);
+       if (dt == NULL) {
+               pr_err("error adding module: %s\n", name);
                return -ENOMEM;
        }
-       dt->mod_name = new_name;
+       /*
+        * For built-in modules, name lives in .rodata and is
+        * immortal. For loaded modules, name points at the name[]
+        * member of struct module, which lives at least as long as
+        * this struct ddebug_table.
+        */
+       dt->mod_name = name;
        dt->num_ddebugs = n;
        dt->ddebugs = tab;
 
@@ -868,7 +870,6 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
        vpr_info("%u debug prints in module %s\n", n, dt->mod_name);
        return 0;
 }
-EXPORT_SYMBOL_GPL(ddebug_add_module);
 
 /* helper for ddebug_dyndbg_(boot|module)_param_cb */
 static int ddebug_dyndbg_param_cb(char *param, char *val,
@@ -913,7 +914,6 @@ int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module)
 static void ddebug_table_free(struct ddebug_table *dt)
 {
        list_del_init(&dt->link);
-       kfree_const(dt->mod_name);
        kfree(dt);
 }
 
@@ -930,15 +930,15 @@ int ddebug_remove_module(const char *mod_name)
 
        mutex_lock(&ddebug_lock);
        list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
-               if (!strcmp(dt->mod_name, mod_name)) {
+               if (dt->mod_name == mod_name) {
                        ddebug_table_free(dt);
                        ret = 0;
+                       break;
                }
        }
        mutex_unlock(&ddebug_lock);
        return ret;
 }
-EXPORT_SYMBOL_GPL(ddebug_remove_module);
 
 static void ddebug_remove_all_tables(void)
 {
index 236eb21..4525fb0 100644 (file)
@@ -20,7 +20,8 @@
 static noinline size_t
 lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
                    unsigned char *out, size_t *out_len,
-                   size_t ti, void *wrkmem)
+                   size_t ti, void *wrkmem, signed char *state_offset,
+                   const unsigned char bitstream_version)
 {
        const unsigned char *ip;
        unsigned char *op;
@@ -35,27 +36,85 @@ lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
        ip += ti < 4 ? 4 - ti : 0;
 
        for (;;) {
-               const unsigned char *m_pos;
+               const unsigned char *m_pos = NULL;
                size_t t, m_len, m_off;
                u32 dv;
+               u32 run_length = 0;
 literal:
                ip += 1 + ((ip - ii) >> 5);
 next:
                if (unlikely(ip >= ip_end))
                        break;
                dv = get_unaligned_le32(ip);
-               t = ((dv * 0x1824429d) >> (32 - D_BITS)) & D_MASK;
-               m_pos = in + dict[t];
-               dict[t] = (lzo_dict_t) (ip - in);
-               if (unlikely(dv != get_unaligned_le32(m_pos)))
-                       goto literal;
+
+               if (dv == 0 && bitstream_version) {
+                       const unsigned char *ir = ip + 4;
+                       const unsigned char *limit = ip_end
+                               < (ip + MAX_ZERO_RUN_LENGTH + 1)
+                               ? ip_end : ip + MAX_ZERO_RUN_LENGTH + 1;
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && \
+       defined(LZO_FAST_64BIT_MEMORY_ACCESS)
+                       u64 dv64;
+
+                       for (; (ir + 32) <= limit; ir += 32) {
+                               dv64 = get_unaligned((u64 *)ir);
+                               dv64 |= get_unaligned((u64 *)ir + 1);
+                               dv64 |= get_unaligned((u64 *)ir + 2);
+                               dv64 |= get_unaligned((u64 *)ir + 3);
+                               if (dv64)
+                                       break;
+                       }
+                       for (; (ir + 8) <= limit; ir += 8) {
+                               dv64 = get_unaligned((u64 *)ir);
+                               if (dv64) {
+#  if defined(__LITTLE_ENDIAN)
+                                       ir += __builtin_ctzll(dv64) >> 3;
+#  elif defined(__BIG_ENDIAN)
+                                       ir += __builtin_clzll(dv64) >> 3;
+#  else
+#    error "missing endian definition"
+#  endif
+                                       break;
+                               }
+                       }
+#else
+                       while ((ir < (const unsigned char *)
+                                       ALIGN((uintptr_t)ir, 4)) &&
+                                       (ir < limit) && (*ir == 0))
+                               ir++;
+                       for (; (ir + 4) <= limit; ir += 4) {
+                               dv = *((u32 *)ir);
+                               if (dv) {
+#  if defined(__LITTLE_ENDIAN)
+                                       ir += __builtin_ctz(dv) >> 3;
+#  elif defined(__BIG_ENDIAN)
+                                       ir += __builtin_clz(dv) >> 3;
+#  else
+#    error "missing endian definition"
+#  endif
+                                       break;
+                               }
+                       }
+#endif
+                       while (likely(ir < limit) && unlikely(*ir == 0))
+                               ir++;
+                       run_length = ir - ip;
+                       if (run_length > MAX_ZERO_RUN_LENGTH)
+                               run_length = MAX_ZERO_RUN_LENGTH;
+               } else {
+                       t = ((dv * 0x1824429d) >> (32 - D_BITS)) & D_MASK;
+                       m_pos = in + dict[t];
+                       dict[t] = (lzo_dict_t) (ip - in);
+                       if (unlikely(dv != get_unaligned_le32(m_pos)))
+                               goto literal;
+               }
 
                ii -= ti;
                ti = 0;
                t = ip - ii;
                if (t != 0) {
                        if (t <= 3) {
-                               op[-2] |= t;
+                               op[*state_offset] |= t;
                                COPY4(op, ii);
                                op += t;
                        } else if (t <= 16) {
@@ -88,6 +147,17 @@ next:
                        }
                }
 
+               if (unlikely(run_length)) {
+                       ip += run_length;
+                       run_length -= MIN_ZERO_RUN_LENGTH;
+                       put_unaligned_le32((run_length << 21) | 0xfffc18
+                                          | (run_length & 0x7), op);
+                       op += 4;
+                       run_length = 0;
+                       *state_offset = -3;
+                       goto finished_writing_instruction;
+               }
+
                m_len = 4;
                {
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && defined(LZO_USE_CTZ64)
@@ -170,7 +240,6 @@ m_len_done:
 
                m_off = ip - m_pos;
                ip += m_len;
-               ii = ip;
                if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) {
                        m_off -= 1;
                        *op++ = (((m_len - 1) << 5) | ((m_off & 7) << 2));
@@ -207,29 +276,45 @@ m_len_done:
                        *op++ = (m_off << 2);
                        *op++ = (m_off >> 6);
                }
+               *state_offset = -2;
+finished_writing_instruction:
+               ii = ip;
                goto next;
        }
        *out_len = op - out;
        return in_end - (ii - ti);
 }
 
-int lzo1x_1_compress(const unsigned char *in, size_t in_len,
+int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len,
                     unsigned char *out, size_t *out_len,
-                    void *wrkmem)
+                    void *wrkmem, const unsigned char bitstream_version)
 {
        const unsigned char *ip = in;
        unsigned char *op = out;
        size_t l = in_len;
        size_t t = 0;
+       signed char state_offset = -2;
+       unsigned int m4_max_offset;
+
+       // LZO v0 will never write 17 as first byte,
+       // so this is used to version the bitstream
+       if (bitstream_version > 0) {
+               *op++ = 17;
+               *op++ = bitstream_version;
+               m4_max_offset = M4_MAX_OFFSET_V1;
+       } else {
+               m4_max_offset = M4_MAX_OFFSET_V0;
+       }
 
        while (l > 20) {
-               size_t ll = l <= (M4_MAX_OFFSET + 1) ? l : (M4_MAX_OFFSET + 1);
+               size_t ll = l <= (m4_max_offset + 1) ? l : (m4_max_offset + 1);
                uintptr_t ll_end = (uintptr_t) ip + ll;
                if ((ll_end + ((t + ll) >> 5)) <= ll_end)
                        break;
                BUILD_BUG_ON(D_SIZE * sizeof(lzo_dict_t) > LZO1X_1_MEM_COMPRESS);
                memset(wrkmem, 0, D_SIZE * sizeof(lzo_dict_t));
-               t = lzo1x_1_do_compress(ip, ll, op, out_len, t, wrkmem);
+               t = lzo1x_1_do_compress(ip, ll, op, out_len, t, wrkmem,
+                                       &state_offset, bitstream_version);
                ip += ll;
                op += *out_len;
                l  -= ll;
@@ -242,7 +327,7 @@ int lzo1x_1_compress(const unsigned char *in, size_t in_len,
                if (op == out && t <= 238) {
                        *op++ = (17 + t);
                } else if (t <= 3) {
-                       op[-2] |= t;
+                       op[state_offset] |= t;
                } else if (t <= 18) {
                        *op++ = (t - 3);
                } else {
@@ -273,7 +358,24 @@ int lzo1x_1_compress(const unsigned char *in, size_t in_len,
        *out_len = op - out;
        return LZO_E_OK;
 }
+
+int lzo1x_1_compress(const unsigned char *in, size_t in_len,
+                    unsigned char *out, size_t *out_len,
+                    void *wrkmem)
+{
+       return lzogeneric1x_1_compress(in, in_len, out, out_len, wrkmem, 0);
+}
+
+int lzorle1x_1_compress(const unsigned char *in, size_t in_len,
+                    unsigned char *out, size_t *out_len,
+                    void *wrkmem)
+{
+       return lzogeneric1x_1_compress(in, in_len, out, out_len,
+                                      wrkmem, LZO_VERSION);
+}
+
 EXPORT_SYMBOL_GPL(lzo1x_1_compress);
+EXPORT_SYMBOL_GPL(lzorle1x_1_compress);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("LZO1X-1 Compressor");
index a1c387f..6d2600e 100644 (file)
@@ -46,11 +46,23 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
        const unsigned char * const ip_end = in + in_len;
        unsigned char * const op_end = out + *out_len;
 
+       unsigned char bitstream_version;
+
        op = out;
        ip = in;
 
        if (unlikely(in_len < 3))
                goto input_overrun;
+
+       if (likely(*ip == 17)) {
+               bitstream_version = ip[1];
+               ip += 2;
+               if (unlikely(in_len < 5))
+                       goto input_overrun;
+       } else {
+               bitstream_version = 0;
+       }
+
        if (*ip > 17) {
                t = *ip++ - 17;
                if (t < 4) {
@@ -154,32 +166,49 @@ copy_literal_run:
                        m_pos -= next >> 2;
                        next &= 3;
                } else {
-                       m_pos = op;
-                       m_pos -= (t & 8) << 11;
-                       t = (t & 7) + (3 - 1);
-                       if (unlikely(t == 2)) {
-                               size_t offset;
-                               const unsigned char *ip_last = ip;
+                       NEED_IP(2);
+                       next = get_unaligned_le16(ip);
+                       if (((next & 0xfffc) == 0xfffc) &&
+                           ((t & 0xf8) == 0x18) &&
+                           likely(bitstream_version)) {
+                               NEED_IP(3);
+                               t &= 7;
+                               t |= ip[2] << 3;
+                               t += MIN_ZERO_RUN_LENGTH;
+                               NEED_OP(t);
+                               memset(op, 0, t);
+                               op += t;
+                               next &= 3;
+                               ip += 3;
+                               goto match_next;
+                       } else {
+                               m_pos = op;
+                               m_pos -= (t & 8) << 11;
+                               t = (t & 7) + (3 - 1);
+                               if (unlikely(t == 2)) {
+                                       size_t offset;
+                                       const unsigned char *ip_last = ip;
 
-                               while (unlikely(*ip == 0)) {
-                                       ip++;
-                                       NEED_IP(1);
-                               }
-                               offset = ip - ip_last;
-                               if (unlikely(offset > MAX_255_COUNT))
-                                       return LZO_E_ERROR;
+                                       while (unlikely(*ip == 0)) {
+                                               ip++;
+                                               NEED_IP(1);
+                                       }
+                                       offset = ip - ip_last;
+                                       if (unlikely(offset > MAX_255_COUNT))
+                                               return LZO_E_ERROR;
 
-                               offset = (offset << 8) - offset;
-                               t += offset + 7 + *ip++;
-                               NEED_IP(2);
+                                       offset = (offset << 8) - offset;
+                                       t += offset + 7 + *ip++;
+                                       NEED_IP(2);
+                                       next = get_unaligned_le16(ip);
+                               }
+                               ip += 2;
+                               m_pos -= next >> 2;
+                               next &= 3;
+                               if (m_pos == op)
+                                       goto eof_found;
+                               m_pos -= 0x4000;
                        }
-                       next = get_unaligned_le16(ip);
-                       ip += 2;
-                       m_pos -= next >> 2;
-                       next &= 3;
-                       if (m_pos == op)
-                               goto eof_found;
-                       m_pos -= 0x4000;
                }
                TEST_LB(m_pos);
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
index 4edefd2..b60851f 100644 (file)
  */
 
 
+/* Version
+ * 0: original lzo version
+ * 1: lzo with support for RLE
+ */
+#define LZO_VERSION 1
+
 #define COPY4(dst, src)        \
                put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
-#if defined(__x86_64__)
+#if defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
 #define COPY8(dst, src)        \
                put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst))
 #else
 
 #if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
 #error "conflicting endian definitions"
-#elif defined(__x86_64__)
+#elif defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
 #define LZO_USE_CTZ64  1
 #define LZO_USE_CTZ32  1
-#elif defined(__i386__) || defined(__powerpc__)
+#define LZO_FAST_64BIT_MEMORY_ACCESS
+#elif defined(CONFIG_X86) || defined(CONFIG_PPC)
 #define LZO_USE_CTZ32  1
-#elif defined(__arm__) && (__LINUX_ARM_ARCH__ >= 5)
+#elif defined(CONFIG_ARM) && (__LINUX_ARM_ARCH__ >= 5)
 #define LZO_USE_CTZ32  1
 #endif
 
 #define M1_MAX_OFFSET  0x0400
 #define M2_MAX_OFFSET  0x0800
 #define M3_MAX_OFFSET  0x4000
-#define M4_MAX_OFFSET  0xbfff
+#define M4_MAX_OFFSET_V0       0xbfff
+#define M4_MAX_OFFSET_V1       0xbffe
 
 #define M1_MIN_LEN     2
 #define M1_MAX_LEN     2
@@ -53,6 +61,9 @@
 #define M3_MARKER      32
 #define M4_MARKER      16
 
+#define MIN_ZERO_RUN_LENGTH    4
+#define MAX_ZERO_RUN_LENGTH    (2047 + MIN_ZERO_RUN_LENGTH)
+
 #define lzo_dict_t      unsigned short
 #define D_BITS         13
 #define D_SIZE         (1u << D_BITS)
index 7cab9a9..7222093 100644 (file)
@@ -631,11 +631,6 @@ static ssize_t trigger_batched_requests_store(struct device *dev,
 
        for (i = 0; i < test_fw_config->num_requests; i++) {
                req = &test_fw_config->reqs[i];
-               if (!req) {
-                       WARN_ON(1);
-                       rc = -ENOMEM;
-                       goto out_bail;
-               }
                req->fw = NULL;
                req->idx = i;
                req->name = test_fw_config->name;
@@ -737,10 +732,6 @@ ssize_t trigger_batched_requests_async_store(struct device *dev,
 
        for (i = 0; i < test_fw_config->num_requests; i++) {
                req = &test_fw_config->reqs[i];
-               if (!req) {
-                       WARN_ON(1);
-                       goto out_bail;
-               }
                req->name = test_fw_config->name;
                req->fw = NULL;
                req->idx = i;
index 280f497..9ea10ad 100644 (file)
@@ -42,14 +42,6 @@ static void test_ubsan_divrem_overflow(void)
        val /= val2;
 }
 
-static void test_ubsan_vla_bound_not_positive(void)
-{
-       volatile int size = -1;
-       char buf[size];
-
-       (void)buf;
-}
-
 static void test_ubsan_shift_out_of_bounds(void)
 {
        volatile int val = -1;
@@ -61,7 +53,7 @@ static void test_ubsan_shift_out_of_bounds(void)
 static void test_ubsan_out_of_bounds(void)
 {
        volatile int i = 4, j = 5;
-       volatile int arr[i];
+       volatile int arr[4];
 
        arr[j] = i;
 }
@@ -113,7 +105,6 @@ static const test_ubsan_fp test_ubsan_array[] = {
        test_ubsan_mul_overflow,
        test_ubsan_negate_overflow,
        test_ubsan_divrem_overflow,
-       test_ubsan_vla_bound_not_positive,
        test_ubsan_shift_out_of_bounds,
        test_ubsan_out_of_bounds,
        test_ubsan_load_invalid_value,
index 3add923..30b00de 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <stdarg.h>
+#include <linux/build_bug.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/module.h>      /* for KSYM_SYMBOL_LEN */
@@ -405,6 +406,8 @@ struct printf_spec {
        unsigned int    base:8;         /* number base, 8, 10 or 16 only */
        signed int      precision:16;   /* # of digits/chars */
 } __packed;
+static_assert(sizeof(struct printf_spec) == 8);
+
 #define FIELD_WIDTH_MAX ((1 << 23) - 1)
 #define PRECISION_MAX ((1 << 15) - 1)
 
@@ -422,8 +425,6 @@ char *number(char *buf, char *end, unsigned long long num,
        int field_width = spec.field_width;
        int precision = spec.precision;
 
-       BUILD_BUG_ON(sizeof(struct printf_spec) != 8);
-
        /* locase = 0 or 0x20. ORing digits or letters with 'locase'
         * produces same digits or (maybe lowercased) letters */
        locase = (spec.flags & SMALL);
index 8bd6494..82d3b51 100644 (file)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/utsname.h>
 #include <sys/wait.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <pthread.h>
 #include <signal.h>
 #include <limits.h>
 #include <syslog.h>
 #include <getopt.h>
 #include <net/if.h>
 #include <linux/if_tun.h>
-#include <linux/if_tun.h>
 #include <linux/virtio_ids.h>
 
 #define MICSYSFSDIR "/sys/class/mic"
index b737ca9..8d8d26b 100755 (executable)
@@ -61,7 +61,7 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
 my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
-my $allow_c99_comments = 1;
+my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
 
 sub help {
        my ($exitcode) = @_;
@@ -466,6 +466,16 @@ our $logFunctions = qr{(?x:
        seq_vprintf|seq_printf|seq_puts
 )};
 
+our $allocFunctions = qr{(?x:
+       (?:(?:devm_)?
+               (?:kv|k|v)[czm]alloc(?:_node|_array)? |
+               kstrdup(?:_const)? |
+               kmemdup(?:_nul)?) |
+       (?:\w+)?alloc_skb(?:ip_align)? |
+                               # dev_alloc_skb/netdev_alloc_skb, et al
+       dma_alloc_coherent
+)};
+
 our $signature_tags = qr{(?xi:
        Signed-off-by:|
        Co-developed-by:|
@@ -1011,6 +1021,7 @@ if ($git) {
 }
 
 my $vname;
+$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
 for my $filename (@ARGV) {
        my $FILE;
        if ($git) {
@@ -3037,6 +3048,14 @@ sub process {
                                        $comment = '..';
                                }
 
+# check SPDX comment style for .[chsS] files
+                               if ($realfile =~ /\.[chsS]$/ &&
+                                   $rawline =~ /SPDX-License-Identifier:/ &&
+                                   $rawline !~ /^\+\s*\Q$comment\E\s*/) {
+                                       WARN("SPDX_LICENSE_TAG",
+                                            "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
+                               }
+
                                if ($comment !~ /^$/ &&
                                    $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {
                                         WARN("SPDX_LICENSE_TAG",
@@ -3054,6 +3073,14 @@ sub process {
 # check we are in a valid source file if not then ignore this hunk
                next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
 
+# check for using SPDX-License-Identifier on the wrong line number
+               if ($realline != $checklicenseline &&
+                   $rawline =~ /\bSPDX-License-Identifier:/ &&
+                   substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) {
+                       WARN("SPDX_LICENSE_TAG",
+                            "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr);
+               }
+
 # line length limit (with some exclusions)
 #
 # There are a few types of lines that may extend beyond $max_line_length:
@@ -5545,7 +5572,8 @@ sub process {
                        my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
 #                      print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
 
-                       if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*(?:devm_)?(?:[kv][czm]alloc(?:_node|_array)?\b|kstrdup|kmemdup|(?:dev_)?alloc_skb)/) {
+                       if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*\(/ &&
+                           $s !~ /\b__GFP_NOWARN\b/ ) {
                                WARN("OOM_MESSAGE",
                                     "Possible unnecessary 'out of memory' message\n" . $hereprev);
                        }
@@ -6196,8 +6224,8 @@ sub process {
                        }
                }
 
-# check for pointless casting of kmalloc return
-               if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) {
+# check for pointless casting of alloc functions
+               if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
                        WARN("UNNECESSARY_CASTS",
                             "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
                }
@@ -6205,7 +6233,7 @@ sub process {
 # alloc style
 # p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...)
                if ($perl_version_ok &&
-                   $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
+                   $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
                        CHK("ALLOC_SIZEOF_STRUCT",
                            "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr);
                }
index 7aad824..d3319a8 100644 (file)
 import gdb
 
 /* linux/fs.h */
-LX_VALUE(MS_RDONLY)
-LX_VALUE(MS_SYNCHRONOUS)
-LX_VALUE(MS_MANDLOCK)
-LX_VALUE(MS_DIRSYNC)
-LX_VALUE(MS_NOATIME)
-LX_VALUE(MS_NODIRATIME)
+LX_VALUE(SB_RDONLY)
+LX_VALUE(SB_SYNCHRONOUS)
+LX_VALUE(SB_MANDLOCK)
+LX_VALUE(SB_DIRSYNC)
+LX_VALUE(SB_NOATIME)
+LX_VALUE(SB_NODIRATIME)
 
 /* linux/mount.h */
 LX_VALUE(MNT_NOSUID)
index 0aebd75..2f01a95 100644 (file)
@@ -114,11 +114,11 @@ def info_opts(lst, opt):
     return opts
 
 
-FS_INFO = {constants.LX_MS_SYNCHRONOUS: ",sync",
-           constants.LX_MS_MANDLOCK: ",mand",
-           constants.LX_MS_DIRSYNC: ",dirsync",
-           constants.LX_MS_NOATIME: ",noatime",
-           constants.LX_MS_NODIRATIME: ",nodiratime"}
+FS_INFO = {constants.LX_SB_SYNCHRONOUS: ",sync",
+           constants.LX_SB_MANDLOCK: ",mand",
+           constants.LX_SB_DIRSYNC: ",dirsync",
+           constants.LX_SB_NOATIME: ",noatime",
+           constants.LX_SB_NODIRATIME: ",nodiratime"}
 
 MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid",
             constants.LX_MNT_NODEV: ",nodev",
@@ -184,7 +184,7 @@ values of that process namespace"""
             fstype = superblock['s_type']['name'].string()
             s_flags = int(superblock['s_flags'])
             m_flags = int(vfs['mnt']['mnt_flags'])
-            rd = "ro" if (s_flags & constants.LX_MS_RDONLY) else "rw"
+            rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
 
             gdb.write(
                 "{} {} {} {}{}{} 0 0\n"
index 517d0c3..86b8733 100644 (file)
@@ -10,6 +10,8 @@
 abandonning||abandoning
 abigious||ambiguous
 abitrate||arbitrate
+abnornally||abnormally
+abnrormal||abnormal
 abord||abort
 aboslute||absolute
 abov||above
@@ -107,6 +109,7 @@ ambigious||ambiguous
 amoung||among
 amout||amount
 amplifer||amplifier
+amplifyer||amplifier
 an union||a union
 an user||a user
 an userspace||a userspace
@@ -145,6 +148,7 @@ artillary||artillery
 asign||assign
 asser||assert
 assertation||assertion
+assertting||asserting
 assiged||assigned
 assigment||assignment
 assigments||assignments
@@ -168,6 +172,8 @@ attachement||attachment
 attched||attached
 attemps||attempts
 attemping||attempting
+attepmpt||attempt
+attnetion||attention
 attruibutes||attributes
 authentification||authentication
 automaticaly||automatically
@@ -217,6 +223,7 @@ boardcast||broadcast
 borad||board
 boundry||boundary
 brievely||briefly
+broadcase||broadcast
 broadcat||broadcast
 bufufer||buffer
 cacluated||calculated
@@ -234,6 +241,7 @@ cancle||cancel
 capabilites||capabilities
 capabilty||capability
 capabitilies||capabilities
+capablity||capability
 capatibilities||capabilities
 capapbilities||capabilities
 caputure||capture
@@ -274,6 +282,7 @@ clared||cleared
 closeing||closing
 clustred||clustered
 coexistance||coexistence
+colescing||coalescing
 collapsable||collapsible
 colorfull||colorful
 comand||command
@@ -290,6 +299,7 @@ comsumer||consumer
 comsuming||consuming
 compability||compatibility
 compaibility||compatibility
+comparsion||comparison
 compatability||compatibility
 compatable||compatible
 compatibiliy||compatibility
@@ -303,6 +313,7 @@ completly||completely
 complient||compliant
 componnents||components
 compoment||component
+comppatible||compatible
 compres||compress
 compresion||compression
 comression||compression
@@ -368,6 +379,8 @@ decsribed||described
 decription||description
 dectected||detected
 defailt||default
+deferal||deferral
+deffered||deferred
 defferred||deferred
 definate||definite
 definately||definitely
@@ -400,6 +413,7 @@ descritptor||descriptor
 desctiptor||descriptor
 desriptor||descriptor
 desriptors||descriptors
+desination||destination
 destionation||destination
 destoried||destroyed
 destory||destroy
@@ -426,7 +440,9 @@ diffrent||different
 differenciate||differentiate
 diffrentiate||differentiate
 difinition||definition
+dimention||dimension
 dimesions||dimensions
+dispalying||displaying
 diplay||display
 directon||direction
 direectly||directly
@@ -442,6 +458,7 @@ disbled||disabled
 disconnet||disconnect
 discontinous||discontinuous
 disharge||discharge
+disnabled||disabled
 dispertion||dispersion
 dissapears||disappears
 distiction||distinction
@@ -456,6 +473,7 @@ dorp||drop
 dosen||doesn
 downlad||download
 downlads||downloads
+droped||dropped
 druing||during
 dynmaic||dynamic
 eanable||enable
@@ -471,6 +489,7 @@ elementry||elementary
 eletronic||electronic
 embeded||embedded
 enabledi||enabled
+enble||enable
 enchanced||enhanced
 encorporating||incorporating
 encrupted||encrypted
@@ -479,6 +498,9 @@ encryptio||encryption
 endianess||endianness
 enhaced||enhanced
 enlightnment||enlightenment
+enqueing||enqueuing
+entires||entries
+entites||entities
 entrys||entries
 enocded||encoded
 enterily||entirely
@@ -498,6 +520,8 @@ etsbalishment||establishment
 excecutable||executable
 exceded||exceeded
 excellant||excellent
+execeeded||exceeded
+execeeds||exceeds
 exeed||exceed
 existance||existence
 existant||existent
@@ -506,6 +530,7 @@ exlcude||exclude
 exlcusive||exclusive
 exmaple||example
 expecially||especially
+experies||expires
 explicite||explicit
 explicitely||explicitly
 explict||explicit
@@ -521,6 +546,7 @@ extracter||extractor
 faield||failed
 falied||failed
 faild||failed
+failded||failed
 failer||failure
 faill||fail
 failied||failed
@@ -540,6 +566,7 @@ fetaure||feature
 fetaures||features
 fileystem||filesystem
 fimware||firmware
+firmare||firmware
 firware||firmware
 finanize||finalize
 findn||find
@@ -574,6 +601,7 @@ funtions||functions
 furthur||further
 futhermore||furthermore
 futrue||future
+gauage||gauge
 gaurenteed||guaranteed
 generiously||generously
 genereate||generate
@@ -645,6 +673,7 @@ independed||independent
 indiate||indicate
 indicat||indicate
 inexpect||inexpected
+inferface||interface
 infomation||information
 informatiom||information
 informations||information
@@ -662,14 +691,17 @@ initialiazation||initialization
 initializiation||initialization
 initialze||initialize
 initialzed||initialized
+initialzing||initializing
 initilization||initialization
 initilize||initialize
 inofficial||unofficial
 inrerface||interface
 insititute||institute
+instace||instance
 instal||install
 instanciate||instantiate
 instanciated||instantiated
+insufficent||insufficient
 inteface||interface
 integreated||integrated
 integrety||integrity
@@ -684,6 +716,8 @@ intermittant||intermittent
 internel||internal
 interoprability||interoperability
 interuupt||interrupt
+interupt||interrupt
+interupts||interrupts
 interrface||interface
 interrrupt||interrupt
 interrup||interrupt
@@ -699,11 +733,14 @@ intialization||initialization
 intialized||initialized
 intialize||initialize
 intregral||integral
+intrerrupt||interrupt
 intrrupt||interrupt
 intterrupt||interrupt
 intuative||intuitive
 inavlid||invalid
 invaid||invalid
+invaild||invalid
+invailid||invalid
 invald||invalid
 invalde||invalid
 invalide||invalid
@@ -712,6 +749,7 @@ invalud||invalid
 invididual||individual
 invokation||invocation
 invokations||invocations
+ireelevant||irrelevant
 irrelevent||irrelevant
 isnt||isn't
 isssue||issue
@@ -747,6 +785,7 @@ loobpack||loopback
 loosing||losing
 losted||lost
 machinary||machinery
+maibox||mailbox
 maintainance||maintenance
 maintainence||maintenance
 maintan||maintain
@@ -758,14 +797,19 @@ managable||manageable
 managment||management
 mangement||management
 manoeuvering||maneuvering
+manufaucturing||manufacturing
 mappping||mapping
 matchs||matches
 mathimatical||mathematical
 mathimatic||mathematic
 mathimatics||mathematics
+maximium||maximum
 maxium||maximum
 mechamism||mechanism
 meetign||meeting
+memeory||memory
+memmber||member
+memoery||memory
 ment||meant
 mergable||mergeable
 mesage||message
@@ -779,6 +823,7 @@ migrateable||migratable
 milliseonds||milliseconds
 minium||minimum
 minimam||minimum
+miniumum||minimum
 minumum||minimum
 misalinged||misaligned
 miscelleneous||miscellaneous
@@ -839,6 +884,7 @@ occurence||occurrence
 occure||occurred
 occured||occurred
 occuring||occurring
+offser||offset
 offet||offset
 offloded||offloaded
 omited||omitted
@@ -855,6 +901,7 @@ optmizations||optimizations
 orientatied||orientated
 orientied||oriented
 orignal||original
+originial||original
 otherise||otherwise
 ouput||output
 oustanding||outstanding
@@ -874,6 +921,7 @@ packege||package
 packge||package
 packtes||packets
 pakage||package
+paket||packet
 pallette||palette
 paln||plan
 paramameters||parameters
@@ -886,6 +934,8 @@ paramters||parameters
 parmaters||parameters
 particuarly||particularly
 particularily||particularly
+partion||partition
+partions||partitions
 partiton||partition
 pased||passed
 passin||passing
@@ -897,10 +947,12 @@ peice||piece
 pendantic||pedantic
 peprocessor||preprocessor
 perfoming||performing
+peripherial||peripheral
 permissons||permissions
 peroid||period
 persistance||persistence
 persistant||persistent
+phoneticly||phonetically
 plalform||platform
 platfoem||platform
 platfrom||platform
@@ -915,6 +967,7 @@ posible||possible
 positon||position
 possibilites||possibilities
 powerfull||powerful
+pramater||parameter
 preamle||preamble
 preample||preamble
 preapre||prepare
@@ -976,6 +1029,7 @@ psudo||pseudo
 psuedo||pseudo
 psychadelic||psychedelic
 pwoer||power
+queing||queuing
 quering||querying
 randomally||randomly
 raoming||roaming
@@ -1004,6 +1058,7 @@ refering||referring
 refernces||references
 refernnce||reference
 refrence||reference
+registed||registered
 registerd||registered
 registeration||registration
 registeresd||registered
@@ -1018,6 +1073,7 @@ regulamentations||regulations
 reigstration||registration
 releated||related
 relevent||relevant
+reloade||reload
 remoote||remote
 remore||remote
 removeable||removable
@@ -1036,19 +1092,23 @@ requried||required
 requst||request
 reregisteration||reregistration
 reseting||resetting
+reseved||reserved
 reseverd||reserved
 resizeable||resizable
 resouce||resource
 resouces||resources
 resoures||resources
 responce||response
+resrouce||resource
 ressizes||resizes
 ressource||resource
 ressources||resources
 restesting||retesting
+resumbmitting||resubmitting
 retransmited||retransmitted
 retreived||retrieved
 retreive||retrieve
+retreiving||retrieving
 retrive||retrieve
 retuned||returned
 reudce||reduce
@@ -1120,6 +1180,7 @@ sleeped||slept
 softwares||software
 speach||speech
 specfic||specific
+specfield||specified
 speciefied||specified
 specifc||specific
 specifed||specified
@@ -1142,7 +1203,10 @@ staion||station
 standardss||standards
 standartization||standardization
 standart||standard
+standy||standby
+stardard||standard
 staticly||statically
+statuss||status
 stoped||stopped
 stoping||stopping
 stoppped||stopped
@@ -1227,12 +1291,14 @@ tipically||typically
 timeing||timing
 timout||timeout
 tmis||this
+toogle||toggle
 torerable||tolerable
 traking||tracking
 tramsmitted||transmitted
 tramsmit||transmit
 tranasction||transaction
 tranfer||transfer
+transcevier||transceiver
 transciever||transceiver
 transferd||transferred
 transfered||transferred
@@ -1267,6 +1333,7 @@ unfortunatelly||unfortunately
 unifiy||unify
 uniterrupted||uninterrupted
 unintialized||uninitialized
+unitialized||uninitialized
 unkmown||unknown
 unknonw||unknown
 unknow||unknown
@@ -1291,7 +1358,9 @@ unsuccessfull||unsuccessful
 unsuported||unsupported
 untill||until
 unuseful||useless
+unvalid||invalid
 upate||update
+upsupported||unsupported
 usefule||useful
 usefull||useful
 usege||usage