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

Merge branch 'akpm' (patches from Andrew)

Merge third patch-bomb from Andrew Morton:
"We're pretty much done over here - I'm still waiting for a nouveau
merge so I can cleanly finish up Christoph's dma-mapping rework.

- bunch of small misc stuff

- fold abs64() into abs(), remove abs64()

- new_valid_dev() cleanups

- binfmt_elf_fdpic feature work"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (24 commits)
fs/binfmt_elf_fdpic.c: provide NOMMU loader for regular ELF binaries
fs/stat.c: remove unnecessary new_valid_dev() check
fs/reiserfs/namei.c: remove unnecessary new_valid_dev() check
fs/nilfs2/namei.c: remove unnecessary new_valid_dev() check
fs/ncpfs/dir.c: remove unnecessary new_valid_dev() check
fs/jfs: remove unnecessary new_valid_dev() checks
fs/hpfs/namei.c: remove unnecessary new_valid_dev() check
fs/f2fs/namei.c: remove unnecessary new_valid_dev() check
fs/ext2/namei.c: remove unnecessary new_valid_dev() check
fs/exofs/namei.c: remove unnecessary new_valid_dev() check
fs/btrfs/inode.c: remove unnecessary new_valid_dev() check
fs/9p: remove unnecessary new_valid_dev() checks
include/linux/kdev_t.h: old/new_valid_dev() can return bool
include/linux/kdev_t.h: remove unused huge_valid_dev()
kmap_atomic_to_page() has no users, remove it
drivers/scsi/cxgbi: fix build with EXTRA_CFLAGS
dma: remove external references to dma_supported
Documentation/sysctl/vm.txt: fix misleading code reference of overcommit_memory
remove abs64()
kernel.h: make abs() work with 64-bit types
...

+104 -221
-13
Documentation/DMA-API.txt
··· 142 142 ------------------------------------ 143 143 144 144 int 145 - dma_supported(struct device *dev, u64 mask) 146 - 147 - Checks to see if the device can support DMA to the memory described by 148 - mask. 149 - 150 - Returns: 1 if it can and 0 if it can't. 151 - 152 - Notes: This routine merely tests to see if the mask is possible. It 153 - won't change the current mask settings. It is more intended as an 154 - internal API for use by the platform than an external API for use by 155 - driver writers. 156 - 157 - int 158 145 dma_set_mask_and_coherent(struct device *dev, u64 mask) 159 146 160 147 Checks to see if the mask is possible and updates the device
+1 -1
Documentation/sysctl/vm.txt
··· 639 639 The default value is 0. 640 640 641 641 See Documentation/vm/overcommit-accounting and 642 - security/commoncap.c::cap_vm_enough_memory() for more information. 642 + mm/mmap.c::__vm_enough_memory() for more information. 643 643 644 644 ============================================================== 645 645
-1
arch/arm/include/asm/highmem.h
··· 68 68 extern void *kmap_atomic(struct page *page); 69 69 extern void __kunmap_atomic(void *kvaddr); 70 70 extern void *kmap_atomic_pfn(unsigned long pfn); 71 - extern struct page *kmap_atomic_to_page(const void *ptr); 72 71 #endif 73 72 74 73 #endif
-10
arch/arm/mm/highmem.c
··· 147 147 148 148 return (void *)vaddr; 149 149 } 150 - 151 - struct page *kmap_atomic_to_page(const void *ptr) 152 - { 153 - unsigned long vaddr = (unsigned long)ptr; 154 - 155 - if (vaddr < FIXADDR_START) 156 - return virt_to_page(ptr); 157 - 158 - return pte_page(get_fixmap_pte(vaddr)); 159 - }
-2
arch/frv/include/asm/highmem.h
··· 62 62 extern void *kmap(struct page *page); 63 63 extern void kunmap(struct page *page); 64 64 65 - extern struct page *kmap_atomic_to_page(void *ptr); 66 - 67 65 #endif /* !__ASSEMBLY__ */ 68 66 69 67 /*
-5
arch/frv/mm/highmem.c
··· 32 32 33 33 EXPORT_SYMBOL(kunmap); 34 34 35 - struct page *kmap_atomic_to_page(void *ptr) 36 - { 37 - return virt_to_page(ptr); 38 - } 39 - 40 35 void *kmap_atomic(struct page *page) 41 36 { 42 37 unsigned long paddr;
-1
arch/metag/include/asm/highmem.h
··· 56 56 extern void *kmap_atomic(struct page *page); 57 57 extern void __kunmap_atomic(void *kvaddr); 58 58 extern void *kmap_atomic_pfn(unsigned long pfn); 59 - extern struct page *kmap_atomic_to_page(void *ptr); 60 59 #endif 61 60 62 61 #endif
-14
arch/metag/mm/highmem.c
··· 111 111 return (void *)vaddr; 112 112 } 113 113 114 - struct page *kmap_atomic_to_page(void *ptr) 115 - { 116 - unsigned long vaddr = (unsigned long)ptr; 117 - int idx; 118 - pte_t *pte; 119 - 120 - if (vaddr < FIXADDR_START) 121 - return virt_to_page(ptr); 122 - 123 - idx = virt_to_fix(vaddr); 124 - pte = kmap_pte - (idx - FIX_KMAP_BEGIN); 125 - return pte_page(*pte); 126 - } 127 - 128 114 void __init kmap_init(void) 129 115 { 130 116 unsigned long kmap_vstart;
-13
arch/microblaze/include/asm/highmem.h
··· 76 76 return kmap_atomic_prot(page, kmap_prot); 77 77 } 78 78 79 - static inline struct page *kmap_atomic_to_page(void *ptr) 80 - { 81 - unsigned long idx, vaddr = (unsigned long) ptr; 82 - pte_t *pte; 83 - 84 - if (vaddr < FIXADDR_START) 85 - return virt_to_page(ptr); 86 - 87 - idx = virt_to_fix(vaddr); 88 - pte = kmap_pte - (idx - FIX_KMAP_BEGIN); 89 - return pte_page(*pte); 90 - } 91 - 92 79 #define flush_cache_kmaps() { flush_icache(); flush_dcache(); } 93 80 94 81 #endif /* __KERNEL__ */
-1
arch/mips/include/asm/highmem.h
··· 49 49 extern void *kmap_atomic(struct page *page); 50 50 extern void __kunmap_atomic(void *kvaddr); 51 51 extern void *kmap_atomic_pfn(unsigned long pfn); 52 - extern struct page *kmap_atomic_to_page(void *ptr); 53 52 54 53 #define flush_cache_kmaps() flush_cache_all() 55 54
+9 -6
arch/mips/include/uapi/asm/unistd.h
··· 379 379 #define __NR_execveat (__NR_Linux + 356) 380 380 #define __NR_userfaultfd (__NR_Linux + 357) 381 381 #define __NR_membarrier (__NR_Linux + 358) 382 + #define __NR_mlock2 (__NR_Linux + 359) 382 383 383 384 /* 384 385 * Offset of the last Linux o32 flavoured syscall 385 386 */ 386 - #define __NR_Linux_syscalls 358 387 + #define __NR_Linux_syscalls 359 387 388 388 389 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 389 390 390 391 #define __NR_O32_Linux 4000 391 - #define __NR_O32_Linux_syscalls 358 392 + #define __NR_O32_Linux_syscalls 359 392 393 393 394 #if _MIPS_SIM == _MIPS_SIM_ABI64 394 395 ··· 716 715 #define __NR_execveat (__NR_Linux + 316) 717 716 #define __NR_userfaultfd (__NR_Linux + 317) 718 717 #define __NR_membarrier (__NR_Linux + 318) 718 + #define __NR_mlock2 (__NR_Linux + 319) 719 719 720 720 /* 721 721 * Offset of the last Linux 64-bit flavoured syscall 722 722 */ 723 - #define __NR_Linux_syscalls 318 723 + #define __NR_Linux_syscalls 319 724 724 725 725 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 726 726 727 727 #define __NR_64_Linux 5000 728 - #define __NR_64_Linux_syscalls 318 728 + #define __NR_64_Linux_syscalls 319 729 729 730 730 #if _MIPS_SIM == _MIPS_SIM_NABI32 731 731 ··· 1057 1055 #define __NR_execveat (__NR_Linux + 320) 1058 1056 #define __NR_userfaultfd (__NR_Linux + 321) 1059 1057 #define __NR_membarrier (__NR_Linux + 322) 1058 + #define __NR_mlock2 (__NR_Linux + 323) 1060 1059 1061 1060 /* 1062 1061 * Offset of the last N32 flavoured syscall 1063 1062 */ 1064 - #define __NR_Linux_syscalls 322 1063 + #define __NR_Linux_syscalls 323 1065 1064 1066 1065 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1067 1066 1068 1067 #define __NR_N32_Linux 6000 1069 - #define __NR_N32_Linux_syscalls 322 1068 + #define __NR_N32_Linux_syscalls 323 1070 1069 1071 1070 #endif /* _UAPI_ASM_UNISTD_H */
+1
arch/mips/kernel/scall32-o32.S
··· 594 594 PTR sys_execveat 595 595 PTR sys_userfaultfd 596 596 PTR sys_membarrier 597 + PTR sys_mlock2
+1
arch/mips/kernel/scall64-64.S
··· 432 432 PTR sys_execveat 433 433 PTR sys_userfaultfd 434 434 PTR sys_membarrier 435 + PTR sys_mlock2 435 436 .size sys_call_table,.-sys_call_table
+1
arch/mips/kernel/scall64-n32.S
··· 422 422 PTR compat_sys_execveat /* 6320 */ 423 423 PTR sys_userfaultfd 424 424 PTR sys_membarrier 425 + PTR sys_mlock2 425 426 .size sysn32_call_table,.-sysn32_call_table
+1
arch/mips/kernel/scall64-o32.S
··· 577 577 PTR compat_sys_execveat 578 578 PTR sys_userfaultfd 579 579 PTR sys_membarrier 580 + PTR sys_mlock2 580 581 .size sys32_call_table,.-sys32_call_table
-13
arch/mips/mm/highmem.c
··· 118 118 return (void*) vaddr; 119 119 } 120 120 121 - struct page *kmap_atomic_to_page(void *ptr) 122 - { 123 - unsigned long idx, vaddr = (unsigned long)ptr; 124 - pte_t *pte; 125 - 126 - if (vaddr < FIXADDR_START) 127 - return virt_to_page(ptr); 128 - 129 - idx = virt_to_fix(vaddr); 130 - pte = kmap_pte - (idx - FIX_KMAP_BEGIN); 131 - return pte_page(*pte); 132 - } 133 - 134 121 void __init kmap_init(void) 135 122 { 136 123 unsigned long kmap_vstart;
-1
arch/parisc/include/asm/cacheflush.h
··· 156 156 157 157 #define kmap_atomic_prot(page, prot) kmap_atomic(page) 158 158 #define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn)) 159 - #define kmap_atomic_to_page(ptr) virt_to_page(ptr) 160 159 161 160 #endif /* _PARISC_CACHEFLUSH_H */ 162 161
-13
arch/powerpc/include/asm/highmem.h
··· 84 84 return kmap_atomic_prot(page, kmap_prot); 85 85 } 86 86 87 - static inline struct page *kmap_atomic_to_page(void *ptr) 88 - { 89 - unsigned long idx, vaddr = (unsigned long) ptr; 90 - pte_t *pte; 91 - 92 - if (vaddr < FIXADDR_START) 93 - return virt_to_page(ptr); 94 - 95 - idx = virt_to_fix(vaddr); 96 - pte = kmap_pte - (idx - FIX_KMAP_BEGIN); 97 - return pte_page(*pte); 98 - } 99 - 100 87 101 88 #define flush_cache_kmaps() flush_cache_all() 102 89
+2 -1
arch/sparc/include/uapi/asm/unistd.h
··· 416 416 #define __NR_memfd_create 348 417 417 #define __NR_bpf 349 418 418 #define __NR_execveat 350 419 + #define __NR_membarrier 351 419 420 420 - #define NR_syscalls 351 421 + #define NR_syscalls 352 421 422 422 423 /* Bitmask values returned from kern_features system call. */ 423 424 #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
+1 -1
arch/sparc/kernel/systbls_32.S
··· 87 87 /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 88 88 /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 89 89 /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf 90 - /*350*/ .long sys_execveat 90 + /*350*/ .long sys_execveat, sys_membarrier
+2 -2
arch/sparc/kernel/systbls_64.S
··· 88 88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev 89 89 /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 90 90 .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf 91 - /*350*/ .word sys32_execveat 91 + /*350*/ .word sys32_execveat, sys_membarrier 92 92 93 93 #endif /* CONFIG_COMPAT */ 94 94 ··· 168 168 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 169 169 /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 170 170 .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf 171 - /*350*/ .word sys64_execveat 171 + /*350*/ .word sys64_execveat, sys_membarrier
-1
arch/tile/include/asm/highmem.h
··· 63 63 void __kunmap_atomic(void *kvaddr); 64 64 void *kmap_atomic_pfn(unsigned long pfn); 65 65 void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot); 66 - struct page *kmap_atomic_to_page(void *ptr); 67 66 void *kmap_atomic_prot(struct page *page, pgprot_t prot); 68 67 void kmap_atomic_fix_kpte(struct page *page, int finished); 69 68
-12
arch/tile/mm/highmem.c
··· 275 275 { 276 276 return kmap_atomic_prot(pfn_to_page(pfn), prot); 277 277 } 278 - 279 - struct page *kmap_atomic_to_page(void *ptr) 280 - { 281 - pte_t *pte; 282 - unsigned long vaddr = (unsigned long)ptr; 283 - 284 - if (vaddr < FIXADDR_START) 285 - return virt_to_page(ptr); 286 - 287 - pte = kmap_get_pte(vaddr); 288 - return pte_page(*pte); 289 - }
-1
arch/x86/include/asm/highmem.h
··· 68 68 void __kunmap_atomic(void *kvaddr); 69 69 void *kmap_atomic_pfn(unsigned long pfn); 70 70 void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot); 71 - struct page *kmap_atomic_to_page(void *ptr); 72 71 73 72 #define flush_cache_kmaps() do { } while (0) 74 73
-14
arch/x86/mm/highmem_32.c
··· 104 104 } 105 105 EXPORT_SYMBOL(__kunmap_atomic); 106 106 107 - struct page *kmap_atomic_to_page(void *ptr) 108 - { 109 - unsigned long idx, vaddr = (unsigned long)ptr; 110 - pte_t *pte; 111 - 112 - if (vaddr < FIXADDR_START) 113 - return virt_to_page(ptr); 114 - 115 - idx = virt_to_fix(vaddr); 116 - pte = kmap_pte - (idx - FIX_KMAP_BEGIN); 117 - return pte_page(*pte); 118 - } 119 - EXPORT_SYMBOL(kmap_atomic_to_page); 120 - 121 107 void __init set_highmem_pages_init(void) 122 108 { 123 109 struct zone *zone;
+2 -2
drivers/gpu/drm/drm_irq.c
··· 261 261 * available. In that case we can't account for this and just 262 262 * hope for the best. 263 263 */ 264 - if (vblrc && (abs64(diff_ns) > 1000000)) 264 + if (vblrc && (abs(diff_ns) > 1000000)) 265 265 store_vblank(dev, pipe, 1, &tvblank); 266 266 267 267 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); ··· 1772 1772 * e.g., due to spurious vblank interrupts. We need to 1773 1773 * ignore those for accounting. 1774 1774 */ 1775 - if (abs64(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) 1775 + if (abs(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) 1776 1776 store_vblank(dev, pipe, 1, &tvblank); 1777 1777 else 1778 1778 DRM_DEBUG("crtc %u: Redundant vblirq ignored. diff_ns = %d\n",
+2 -2
drivers/gpu/drm/tegra/sor.c
··· 555 555 error = div_s64(active_sym - approx, tu_size); 556 556 error *= params->num_clocks; 557 557 558 - if (error <= 0 && abs64(error) < params->error) { 558 + if (error <= 0 && abs(error) < params->error) { 559 559 params->active_count = div_u64(active_count, f); 560 560 params->active_polarity = active_polarity; 561 561 params->active_frac = active_frac; 562 - params->error = abs64(error); 562 + params->error = abs(error); 563 563 params->tu_size = tu_size; 564 564 565 565 if (error == 0)
+2 -2
drivers/input/joystick/walkera0701.c
··· 150 150 if (w->counter == 24) { /* full frame */ 151 151 walkera0701_parse_frame(w); 152 152 w->counter = NO_SYNC; 153 - if (abs64(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ 153 + if (abs(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ 154 154 w->counter = 0; 155 155 } else { 156 156 if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) ··· 161 161 } else 162 162 w->counter = NO_SYNC; 163 163 } 164 - } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) < 164 + } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < 165 165 RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ 166 166 w->counter = 0; 167 167
+1 -1
drivers/media/i2c/ov9650.c
··· 1133 1133 if (mbus_fmt->width != iv->size.width || 1134 1134 mbus_fmt->height != iv->size.height) 1135 1135 continue; 1136 - err = abs64((u64)(iv->interval.numerator * 10000) / 1136 + err = abs((u64)(iv->interval.numerator * 10000) / 1137 1137 iv->interval.denominator - req_int); 1138 1138 if (err < min_err) { 1139 1139 fiv = iv;
+1 -1
drivers/net/wireless/mac80211_hwsim.c
··· 787 787 struct mac80211_hwsim_data *data = hw->priv; 788 788 u64 now = mac80211_hwsim_get_tsf(hw, vif); 789 789 u32 bcn_int = data->beacon_int; 790 - u64 delta = abs64(tsf - now); 790 + u64 delta = abs(tsf - now); 791 791 792 792 /* adjust after beaconing with new timestamp at old TBTT */ 793 793 if (tsf > now) {
+1 -1
drivers/scsi/cxgbi/cxgb3i/Kbuild
··· 1 - EXTRA_CFLAGS += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb3 1 + ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb3 2 2 3 3 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
+1 -1
drivers/scsi/cxgbi/cxgb4i/Kbuild
··· 1 - EXTRA_CFLAGS += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb4 1 + ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb4 2 2 3 3 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
+1 -1
drivers/thermal/power_allocator.c
··· 228 228 if (err < int_to_frac(tz->tzp->integral_cutoff)) { 229 229 s64 i_next = i + mul_frac(tz->tzp->k_i, err); 230 230 231 - if (abs64(i_next) < max_power_frac) { 231 + if (abs(i_next) < max_power_frac) { 232 232 i = i_next; 233 233 params->err_integral += err; 234 234 }
+1 -1
drivers/usb/host/ehci-hcd.c
··· 589 589 * streaming mappings for I/O buffers, like pci_map_single(), 590 590 * can return segments above 4GB, if the device allows. 591 591 * 592 - * NOTE: the dma mask is visible through dma_supported(), so 592 + * NOTE: the dma mask is visible through dev->dma_mask, so 593 593 * drivers can pass this info along ... like NETIF_F_HIGHDMA, 594 594 * Scsi_Host.highmem_io, and so forth. It's readonly to all 595 595 * host side drivers though.
+1 -1
drivers/usb/host/fotg210-hcd.c
··· 5063 5063 * streaming mappings for I/O buffers, like pci_map_single(), 5064 5064 * can return segments above 4GB, if the device allows. 5065 5065 * 5066 - * NOTE: the dma mask is visible through dma_supported(), so 5066 + * NOTE: the dma mask is visible through dev->dma_mask, so 5067 5067 * drivers can pass this info along ... like NETIF_F_HIGHDMA, 5068 5068 * Scsi_Host.highmem_io, and so forth. It's readonly to all 5069 5069 * host side drivers though.
+1 -1
drivers/usb/host/oxu210hp-hcd.c
··· 2721 2721 * streaming mappings for I/O buffers, like pci_map_single(), 2722 2722 * can return segments above 4GB, if the device allows. 2723 2723 * 2724 - * NOTE: the dma mask is visible through dma_supported(), so 2724 + * NOTE: the dma mask is visible through dev->dma_mask, so 2725 2725 * drivers can pass this info along ... like NETIF_F_HIGHDMA, 2726 2726 * Scsi_Host.highmem_io, and so forth. It's readonly to all 2727 2727 * host side drivers though.
-3
fs/9p/vfs_inode.c
··· 1368 1368 dir->i_ino, dentry, mode, 1369 1369 MAJOR(rdev), MINOR(rdev)); 1370 1370 1371 - if (!new_valid_dev(rdev)) 1372 - return -EINVAL; 1373 - 1374 1371 /* build extension */ 1375 1372 if (S_ISBLK(mode)) 1376 1373 sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev));
-3
fs/9p/vfs_inode_dotl.c
··· 829 829 dir->i_ino, dentry, omode, 830 830 MAJOR(rdev), MINOR(rdev)); 831 831 832 - if (!new_valid_dev(rdev)) 833 - return -EINVAL; 834 - 835 832 v9ses = v9fs_inode2v9ses(dir); 836 833 dir_dentry = dentry->d_parent; 837 834 dfid = v9fs_fid_lookup(dir_dentry);
+38 -8
fs/binfmt_elf_fdpic.c
··· 103 103 core_initcall(init_elf_fdpic_binfmt); 104 104 module_exit(exit_elf_fdpic_binfmt); 105 105 106 - static int is_elf_fdpic(struct elfhdr *hdr, struct file *file) 106 + static int is_elf(struct elfhdr *hdr, struct file *file) 107 107 { 108 108 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0) 109 109 return 0; 110 110 if (hdr->e_type != ET_EXEC && hdr->e_type != ET_DYN) 111 111 return 0; 112 - if (!elf_check_arch(hdr) || !elf_check_fdpic(hdr)) 112 + if (!elf_check_arch(hdr)) 113 113 return 0; 114 114 if (!file->f_op->mmap) 115 115 return 0; 116 116 return 1; 117 + } 118 + 119 + #ifndef elf_check_fdpic 120 + #define elf_check_fdpic(x) 0 121 + #endif 122 + 123 + #ifndef elf_check_const_displacement 124 + #define elf_check_const_displacement(x) 0 125 + #endif 126 + 127 + static int is_constdisp(struct elfhdr *hdr) 128 + { 129 + if (!elf_check_fdpic(hdr)) 130 + return 1; 131 + if (elf_check_const_displacement(hdr)) 132 + return 1; 133 + return 0; 117 134 } 118 135 119 136 /*****************************************************************************/ ··· 208 191 209 192 /* check that this is a binary we know how to deal with */ 210 193 retval = -ENOEXEC; 211 - if (!is_elf_fdpic(&exec_params.hdr, bprm->file)) 194 + if (!is_elf(&exec_params.hdr, bprm->file)) 212 195 goto error; 196 + if (!elf_check_fdpic(&exec_params.hdr)) { 197 + #ifdef CONFIG_MMU 198 + /* binfmt_elf handles non-fdpic elf except on nommu */ 199 + goto error; 200 + #else 201 + /* nommu can only load ET_DYN (PIE) ELF */ 202 + if (exec_params.hdr.e_type != ET_DYN) 203 + goto error; 204 + #endif 205 + } 213 206 214 207 /* read the program header table */ 215 208 retval = elf_fdpic_fetch_phdrs(&exec_params, bprm->file); ··· 296 269 297 270 } 298 271 299 - if (elf_check_const_displacement(&exec_params.hdr)) 272 + if (is_constdisp(&exec_params.hdr)) 300 273 exec_params.flags |= ELF_FDPIC_FLAG_CONSTDISP; 301 274 302 275 /* perform insanity checks on the interpreter */ 303 276 if (interpreter_name) { 304 277 retval = -ELIBBAD; 305 - if (!is_elf_fdpic(&interp_params.hdr, interpreter)) 278 + if (!is_elf(&interp_params.hdr, interpreter)) 306 279 goto error; 307 280 308 281 interp_params.flags = ELF_FDPIC_FLAG_PRESENT; ··· 333 306 334 307 retval = -ENOEXEC; 335 308 if (stack_size == 0) 336 - goto error; 309 + stack_size = 131072UL; /* same as exec.c's default commit */ 337 310 338 - if (elf_check_const_displacement(&interp_params.hdr)) 311 + if (is_constdisp(&interp_params.hdr)) 339 312 interp_params.flags |= ELF_FDPIC_FLAG_CONSTDISP; 340 313 341 314 /* flush all traces of the currently running executable */ ··· 346 319 /* there's now no turning back... the old userspace image is dead, 347 320 * defunct, deceased, etc. 348 321 */ 349 - set_personality(PER_LINUX_FDPIC); 322 + if (elf_check_fdpic(&exec_params.hdr)) 323 + set_personality(PER_LINUX_FDPIC); 324 + else 325 + set_personality(PER_LINUX); 350 326 if (elf_read_implies_exec(&exec_params.hdr, executable_stack)) 351 327 current->personality |= READ_IMPLIES_EXEC; 352 328
-3
fs/btrfs/inode.c
··· 6360 6360 u64 objectid; 6361 6361 u64 index = 0; 6362 6362 6363 - if (!new_valid_dev(rdev)) 6364 - return -EINVAL; 6365 - 6366 6363 /* 6367 6364 * 2 for inode item and ref 6368 6365 * 2 for dir items
-3
fs/exofs/namei.c
··· 80 80 struct inode *inode; 81 81 int err; 82 82 83 - if (!new_valid_dev(rdev)) 84 - return -EINVAL; 85 - 86 83 inode = exofs_new_inode(dir, mode); 87 84 err = PTR_ERR(inode); 88 85 if (!IS_ERR(inode)) {
-3
fs/ext2/namei.c
··· 143 143 struct inode * inode; 144 144 int err; 145 145 146 - if (!new_valid_dev(rdev)) 147 - return -EINVAL; 148 - 149 146 err = dquot_initialize(dir); 150 147 if (err) 151 148 return err;
+2 -2
fs/ext4/mballoc.c
··· 3333 3333 atomic_inc(&pa->pa_count); 3334 3334 return pa; 3335 3335 } 3336 - cur_distance = abs64(goal_block - cpa->pa_pstart); 3337 - new_distance = abs64(goal_block - pa->pa_pstart); 3336 + cur_distance = abs(goal_block - cpa->pa_pstart); 3337 + new_distance = abs(goal_block - pa->pa_pstart); 3338 3338 3339 3339 if (cur_distance <= new_distance) 3340 3340 return cpa;
-3
fs/f2fs/namei.c
··· 481 481 struct inode *inode; 482 482 int err = 0; 483 483 484 - if (!new_valid_dev(rdev)) 485 - return -EINVAL; 486 - 487 484 f2fs_balance_fs(sbi); 488 485 489 486 inode = f2fs_new_inode(dir, mode);
+2 -1
fs/fs-writeback.c
··· 1981 1981 * page->mapping->host, so the page-dirtying time is recorded in the internal 1982 1982 * blockdev inode. 1983 1983 */ 1984 - #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) 1985 1984 void __mark_inode_dirty(struct inode *inode, int flags) 1986 1985 { 1986 + #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) 1987 1987 struct super_block *sb = inode->i_sb; 1988 1988 int dirtytime; 1989 1989 ··· 2093 2093 out_unlock_inode: 2094 2094 spin_unlock(&inode->i_lock); 2095 2095 2096 + #undef I_DIRTY_INODE 2096 2097 } 2097 2098 EXPORT_SYMBOL(__mark_inode_dirty); 2098 2099
+1 -1
fs/gfs2/lock_dlm.c
··· 50 50 s64 delta = sample - s->stats[index]; 51 51 s->stats[index] += (delta >> 3); 52 52 index++; 53 - s->stats[index] += ((abs64(delta) - s->stats[index]) >> 2); 53 + s->stats[index] += ((abs(delta) - s->stats[index]) >> 2); 54 54 } 55 55 56 56 /**
-2
fs/hpfs/namei.c
··· 227 227 int err; 228 228 if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; 229 229 if (hpfs_sb(dir->i_sb)->sb_eas < 2) return -EPERM; 230 - if (!new_valid_dev(rdev)) 231 - return -EINVAL; 232 230 hpfs_lock(dir->i_sb); 233 231 err = -ENOSPC; 234 232 fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh);
+1
fs/inode.c
··· 1597 1597 /** 1598 1598 * touch_atime - update the access time 1599 1599 * @path: the &struct path to update 1600 + * @inode: inode to update 1600 1601 * 1601 1602 * Update the accessed time on an inode and mark it for writeback. 1602 1603 * This function automatically handles read only file systems and media,
-3
fs/jfs/namei.c
··· 1372 1372 tid_t tid; 1373 1373 struct tblock *tblk; 1374 1374 1375 - if (!new_valid_dev(rdev)) 1376 - return -EINVAL; 1377 - 1378 1375 jfs_info("jfs_mknod: %pd", dentry); 1379 1376 1380 1377 rc = dquot_initialize(dir);
-3
fs/jfs/super.c
··· 496 496 497 497 jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags); 498 498 499 - if (!new_valid_dev(sb->s_bdev->bd_dev)) 500 - return -EOVERFLOW; 501 - 502 499 sbi = kzalloc(sizeof(struct jfs_sb_info), GFP_KERNEL); 503 500 if (!sbi) 504 501 return -ENOMEM;
-2
fs/ncpfs/dir.c
··· 1165 1165 static int ncp_mknod(struct inode * dir, struct dentry *dentry, 1166 1166 umode_t mode, dev_t rdev) 1167 1167 { 1168 - if (!new_valid_dev(rdev)) 1169 - return -EINVAL; 1170 1168 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) { 1171 1169 ncp_dbg(1, "mode = 0%ho\n", mode); 1172 1170 return ncp_create_new(dir, dentry, mode, rdev, 0);
-3
fs/nilfs2/namei.c
··· 120 120 struct nilfs_transaction_info ti; 121 121 int err; 122 122 123 - if (!new_valid_dev(rdev)) 124 - return -EINVAL; 125 - 126 123 err = nilfs_transaction_begin(dir->i_sb, &ti, 1); 127 124 if (err) 128 125 return err;
-3
fs/reiserfs/namei.c
··· 712 712 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 713 713 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 714 714 715 - if (!new_valid_dev(rdev)) 716 - return -EINVAL; 717 - 718 715 retval = dquot_initialize(dir); 719 716 if (retval) 720 717 return retval;
-2
fs/stat.c
··· 367 367 INIT_STRUCT_STAT64_PADDING(tmp); 368 368 #ifdef CONFIG_MIPS 369 369 /* mips has weird padding, so we don't get 64 bits there */ 370 - if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev)) 371 - return -EOVERFLOW; 372 370 tmp.st_dev = new_encode_dev(stat->dev); 373 371 tmp.st_rdev = new_encode_dev(stat->rdev); 374 372 #else
-1
include/linux/highmem.h
··· 78 78 } 79 79 80 80 #define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn)) 81 - #define kmap_atomic_to_page(ptr) virt_to_page(ptr) 82 81 83 82 #define kmap_flush_unused() do {} while(0) 84 83 #endif
+2 -7
include/linux/kdev_t.h
··· 20 20 }) 21 21 22 22 /* acceptable for old filesystems */ 23 - static inline int old_valid_dev(dev_t dev) 23 + static inline bool old_valid_dev(dev_t dev) 24 24 { 25 25 return MAJOR(dev) < 256 && MINOR(dev) < 256; 26 26 } ··· 35 35 return MKDEV((val >> 8) & 255, val & 255); 36 36 } 37 37 38 - static inline int new_valid_dev(dev_t dev) 38 + static inline bool new_valid_dev(dev_t dev) 39 39 { 40 40 return 1; 41 41 } ··· 52 52 unsigned major = (dev & 0xfff00) >> 8; 53 53 unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); 54 54 return MKDEV(major, minor); 55 - } 56 - 57 - static inline int huge_valid_dev(dev_t dev) 58 - { 59 - return 1; 60 55 } 61 56 62 57 static inline u64 huge_encode_dev(dev_t dev)
+21 -21
include/linux/kernel.h
··· 200 200 201 201 #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) 202 202 203 - /* 204 - * abs() handles unsigned and signed longs, ints, shorts and chars. For all 205 - * input types abs() returns a signed long. 206 - * abs() should not be used for 64-bit types (s64, u64, long long) - use abs64() 207 - * for those. 203 + /** 204 + * abs - return absolute value of an argument 205 + * @x: the value. If it is unsigned type, it is converted to signed type first 206 + * (s64, long or int depending on its size). 207 + * 208 + * Return: an absolute value of x. If x is 64-bit, macro's return type is s64, 209 + * otherwise it is signed long. 208 210 */ 209 - #define abs(x) ({ \ 210 - long ret; \ 211 - if (sizeof(x) == sizeof(long)) { \ 212 - long __x = (x); \ 213 - ret = (__x < 0) ? -__x : __x; \ 214 - } else { \ 215 - int __x = (x); \ 216 - ret = (__x < 0) ? -__x : __x; \ 217 - } \ 218 - ret; \ 219 - }) 220 - 221 - #define abs64(x) ({ \ 222 - s64 __x = (x); \ 223 - (__x < 0) ? -__x : __x; \ 224 - }) 211 + #define abs(x) __builtin_choose_expr(sizeof(x) == sizeof(s64), ({ \ 212 + s64 __x = (x); \ 213 + (__x < 0) ? -__x : __x; \ 214 + }), ({ \ 215 + long ret; \ 216 + if (sizeof(x) == sizeof(long)) { \ 217 + long __x = (x); \ 218 + ret = (__x < 0) ? -__x : __x; \ 219 + } else { \ 220 + int __x = (x); \ 221 + ret = (__x < 0) ? -__x : __x; \ 222 + } \ 223 + ret; \ 224 + })) 225 225 226 226 /** 227 227 * reciprocal_scale - "scale" a value into range [0, ep_ro)
+1 -1
kernel/time/clocksource.c
··· 217 217 continue; 218 218 219 219 /* Check the deviation from the watchdog clocksource. */ 220 - if (abs64(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { 220 + if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { 221 221 pr_warn("timekeeping watchdog: Marking clocksource '%s' as unstable because the skew is too large:\n", 222 222 cs->name); 223 223 pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %llx\n",
+1 -1
kernel/time/timekeeping.c
··· 1614 1614 negative = (tick_error < 0); 1615 1615 1616 1616 /* Sort out the magnitude of the correction */ 1617 - tick_error = abs64(tick_error); 1617 + tick_error = abs(tick_error); 1618 1618 for (adj = 0; tick_error > interval; adj++) 1619 1619 tick_error >>= 1; 1620 1620
+1 -1
lib/div64.c
··· 162 162 { 163 163 s64 quot, t; 164 164 165 - quot = div64_u64(abs64(dividend), abs64(divisor)); 165 + quot = div64_u64(abs(dividend), abs(divisor)); 166 166 t = (dividend ^ divisor) >> 63; 167 167 168 168 return (quot ^ t) - t;
+1 -1
net/sctp/transport.c
··· 331 331 * 1/8, rto_alpha would be expressed as 3. 332 332 */ 333 333 tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta) 334 - + (((__u32)abs64((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta); 334 + + (((__u32)abs((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta); 335 335 tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha) 336 336 + (rtt >> net->sctp.rto_alpha); 337 337 } else {