linux/arch/arm64/include/asm
Mark Rutland d135b8b506 arm64: uaccess: suppress spurious clang warning
Clang tries to warn when there's a mismatch between an operand's size,
and the size of the register it is held in, as this may indicate a bug.
Specifically, clang warns when the operand's type is less than 64 bits
wide, and the register is used unqualified (i.e. %N rather than %xN or
%wN).

Unfortunately clang can generate these warnings for unreachable code.
For example, for code like:

do {                                            \
        typeof(*(ptr)) __v = (v);               \
        switch(sizeof(*(ptr))) {                \
        case 1:                                 \
                // assume __v is 1 byte wide    \
                asm ("{op}b %w0" : : "r" (v));  \
                break;                          \
        case 8:                                 \
                // assume __v is 8 bytes wide   \
                asm ("{op} %0" : : "r" (v));    \
                break;                          \
        }
while (0)

... if op() were passed a char value and pointer to char, clang may
produce a warning for the unreachable case where sizeof(*(ptr)) is 8.

For the same reasons, clang produces warnings when __put_user_err() is
used for types that are less than 64 bits wide.

We could avoid this with a cast to a fixed-width type in each of the
cases. However, GCC will then warn that pointer types are being cast to
mismatched integer sizes (in unreachable paths).

Another option would be to use the same union trickery as we do for
__smp_store_release() and __smp_load_acquire(), but this is fairly
invasive.

Instead, this patch suppresses the clang warning by using an x modifier
in the assembly for the 8 byte case of __put_user_err(). No additional
work is necessary as the value has been cast to typeof(*(ptr)), so the
compiler will have performed any necessary extension for the reachable
case.

For consistency, __get_user_err() is also updated to use the x modifier
for its 8 byte case.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2017-05-09 17:47:27 +01:00
..
xen arm/arm64: xen: Move shared architecture headers to include/xen/arm 2016-12-02 11:49:55 -08:00
acenv.h
acpi.h arm64: add function to get a cpu's MADT GICC table 2017-04-11 16:29:54 +01:00
alternative.h arm64: Fix circular include of asm/lse.h through linux/jump_label.h 2016-11-05 20:59:06 +00:00
arch_gicv3.h arm64: sysreg: subsume GICv3 sysreg definitions 2017-03-09 15:29:45 +00:00
arch_timer.h clocksource/drivers/arm_arch_timer: Introduce generic errata handling infrastructure 2017-02-08 00:14:03 +01:00
arm-cci.h
asm-offsets.h
asm-uaccess.h arm64: entry: improve data abort handling of tagged pointers 2017-05-09 17:26:59 +01:00
assembler.h arm64 updates for 4.11: 2017-02-22 10:46:44 -08:00
atomic_ll_sc.h locking/atomic, arch/arm64: Implement atomic{,64}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}() 2016-06-16 10:48:21 +02:00
atomic_lse.h arm64: atomic_lse: match asm register sizes 2017-05-09 17:47:17 +01:00
atomic.h locking/atomic: Remove linux/atomic.h:atomic_fetch_or() 2016-06-16 10:48:32 +02:00
barrier.h arm64: ensure extension of smp_store_release value 2017-05-09 17:45:04 +01:00
bitops.h
bitrev.h
boot.h
brk-imm.h
bug.h arm64: define BUG() instruction without CONFIG_BUG 2017-03-22 17:21:37 +00:00
cache.h arm64: cache: Identify VPIPT I-caches 2017-03-20 16:17:02 +00:00
cacheflush.h arm64: mm: add set_memory_valid() 2017-04-05 18:27:53 +01:00
checksum.h arm64: Implement optimised IP checksum helpers 2016-06-21 15:09:11 +01:00
clocksource.h arm/arm64: arch_timer: Use archdata to indicate vdso suitability 2016-09-23 17:19:25 +01:00
cmpxchg.h arm64: xchg: hazard against entire exchange variable 2017-05-09 17:44:50 +01:00
compat.h sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
compiler.h
cpu_ops.h
cpu.h arm64: cpuinfo: Expose MIDR_EL1 and REVIDR_EL1 to sysfs 2016-07-12 16:09:37 +01:00
cpucaps.h arm64: cpu_errata: Add capability to advertise Cortex-A73 erratum 858921 2017-04-07 11:22:08 +01:00
cpufeature.h arm64: cpufeature: Make ID reg accessor naming less counterintuitive 2017-04-04 16:55:41 +01:00
cpuidle.h
cputype.h arm64: Define Cortex-A73 MIDR 2017-04-07 11:22:08 +01:00
current.h arm64: restore get_current() optimisation 2017-01-04 16:26:18 +00:00
dcc.h arm64: dcc: simplify accessors 2016-09-09 11:41:13 +01:00
debug-monitors.h arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
device.h treewide: Move dma_ops from struct dev_archdata into struct device 2017-01-24 12:23:35 -05:00
dma-mapping.h treewide: Consolidate get_dma_ops() implementations 2017-01-24 12:23:35 -05:00
dmi.h
efi.h arm/efi: Allow invocation of arbitrary runtime services 2017-02-07 10:42:09 +01:00
elf.h arm64: introduce mm context flag to keep 32 bit task information 2016-11-07 18:15:21 +00:00
esr.h arm64: Add CNTFRQ_EL0 trap handler 2017-04-24 12:22:25 +01:00
exception.h
exec.h arm64: suspend: Reconfigure PSTATE after resume from idle 2016-10-20 09:50:54 +01:00
fb.h
fixmap.h
fpsimd.h
fpsimdmacros.h
ftrace.h
futex.h arm64: Factor out PAN enabling/disabling into separate uaccess_* macros 2016-11-21 17:33:47 +00:00
hardirq.h arm64: kdump: implement machine_crash_shutdown() 2017-04-05 18:29:15 +01:00
hugetlb.h
hw_breakpoint.h arm64: cpufeature: Make ID reg accessor naming less counterintuitive 2017-04-04 16:55:41 +01:00
hwcap.h
hypervisor.h
insn.h arm64: Add helper to decode register from instruction 2017-01-10 17:11:23 +00:00
io.h arm, arm64: don't include blk_types.h in <asm/io.h> 2016-11-01 09:43:26 -06:00
irq_work.h
irq.h
irqflags.h arm64: debug: remove unused local_dbg_{enable, disable} macros 2016-07-19 16:59:40 +01:00
jump_label.h
kasan.h
Kbuild sched/cputime: Remove generic asm headers 2017-02-01 09:14:07 +01:00
kernel-pgtable.h arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
kexec.h arm64: kdump: implement machine_crash_shutdown() 2017-04-05 18:29:15 +01:00
kgdb.h arm64: kgdb: Match pstate size with gdbserver protocol 2016-06-16 19:20:51 +01:00
kprobes.h kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
kvm_arm.h arm64: KVM: Save/restore the host SPE state when entering/leaving a VM 2017-02-02 18:33:01 +00:00
kvm_asm.h arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU 2016-11-04 17:56:28 +00:00
kvm_coproc.h
kvm_emulate.h arm64: KVM: Take S1 walks into account when determining S2 write faults 2016-10-21 17:25:47 +01:00
kvm_host.h KVM: arm64: Increase number of user memslots to 512 2017-03-09 09:13:50 +00:00
kvm_hyp.h arm64: KVM: Inject a vSerror if detecting a bad GICV access at EL2 2016-09-08 12:53:00 +02:00
kvm_mmio.h KVM: arm/arm64: Export mmio_read/write_bus 2016-05-20 15:39:42 +02:00
kvm_mmu.h arm64: cpufeature: Make ID reg accessor naming less counterintuitive 2017-04-04 16:55:41 +01:00
kvm_psci.h
linkage.h
lse.h arm64: do not trace atomic operations 2017-02-06 19:00:23 +00:00
memblock.h
memory.h arm64 updates for 4.11: 2017-02-22 10:46:44 -08:00
mmu_context.h sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
mmu.h arm64: alternatives: apply boot time fixups via the linear mapping 2017-03-23 13:54:19 +00:00
mmzone.h
module.h arm64: module: split core and init PLT sections 2017-04-26 12:31:00 +01:00
neon.h arm64: Support systems without FP/ASIMD 2016-11-16 18:05:10 +00:00
numa.h ACPI/NUMA: Do not map pxm to node when NUMA is turned off 2016-12-15 11:32:32 +01:00
page.h arm64: move {PAGE,CONT}_SHIFT into Kconfig 2016-06-03 10:57:18 +01:00
paravirt.h
pci.h
percpu.h arm64: factor out current_stack_pointer 2016-11-11 18:25:43 +00:00
perf_event.h arm64 updates for 4.10: 2016-12-13 16:39:21 -08:00
pgalloc.h arm64: get rid of superfluous __GFP_REPEAT 2016-06-24 17:23:52 -07:00
pgtable-hwdef.h arm64: simplify sysreg manipulation 2016-09-09 11:43:50 +01:00
pgtable-prot.h arm64: Introduce execute-only page access permissions 2016-08-25 18:00:29 +01:00
pgtable-types.h arch, mm: convert all architectures to use 5level-fixup.h 2017-03-09 11:48:47 -08:00
pgtable.h arm64: mm: set the contiguous bit for kernel mappings where appropriate 2017-03-23 14:09:23 +00:00
probes.h arm64: Remove reference to asm/opcodes.h 2016-12-05 10:42:34 +00:00
proc-fns.h
processor.h arm64: struct debug_info: Check CONFIG_HAVE_HW_BREAKPOINT 2017-03-22 17:21:38 +00:00
ptdump.h arm64: dump: Add checking for writable and exectuable pages 2016-11-07 18:15:04 +00:00
ptrace.h arm64: ptrace: add XZR-safe regs accessors 2017-02-15 12:20:29 +00:00
seccomp.h
sections.h arm64: mmu: apply strict permissions to .init.text and .init.data 2017-03-23 13:54:50 +00:00
shmparam.h
signal32.h
smp_plat.h
smp.h arm64: kdump: implement machine_crash_shutdown() 2017-04-05 18:29:15 +01:00
sparsemem.h
spinlock_types.h
spinlock.h arm64 updates for 4.9: 2016-10-03 08:58:35 -07:00
stack_pointer.h arm64: factor out current_stack_pointer 2016-11-11 18:25:43 +00:00
stackprotector.h
stacktrace.h
stage2_pgtable-nopmd.h
stage2_pgtable-nopud.h
stage2_pgtable.h
stat.h
string.h
suspend.h arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx 2016-11-11 18:25:44 +00:00
sync_bitops.h
syscall.h
sysreg.h Merge branch 'arm64/common-sysreg' of git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux into for-next/core 2017-04-04 18:08:47 +01:00
system_misc.h arm64: cleanup unused UDBG_* define 2016-08-31 13:45:46 +01:00
thread_info.h arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
timex.h
tlb.h
tlbflush.h arm64: Work around Falkor erratum 1009 2017-02-01 15:41:50 +00:00
topology.h
traps.h arm64: Create sections.h 2016-08-25 18:00:29 +01:00
uaccess.h arm64: uaccess: suppress spurious clang warning 2017-05-09 17:47:27 +01:00
unistd32.h arm64: unistd32.h: wire up missing syscalls for compat tasks 2016-06-01 18:48:20 +01:00
unistd.h arm64: unistd32.h: wire up missing syscalls for compat tasks 2016-06-01 18:48:20 +01:00
uprobes.h arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
vdso_datapage.h arm64: Add support for CLOCK_MONOTONIC_RAW in clock_gettime() vDSO 2016-07-12 16:06:32 +01:00
vdso.h
virt.h KVM: arm64: Access CNTHCTL_EL2 bit fields correctly on VHE systems 2017-01-13 11:19:25 +00:00
word-at-a-time.h Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00