OpenCloudOS-Kernel/arch/ia64/include/asm
Linus Torvalds 30c44659f4 Merge branch 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
Pull strscpy string copy function implementation from Chris Metcalf.

Chris sent this during the merge window, but I waffled back and forth on
the pull request, which is why it's going in only now.

The new "strscpy()" function is definitely easier to use and more secure
than either strncpy() or strlcpy(), both of which are horrible nasty
interfaces that have serious and irredeemable problems.

strncpy() has a useless return value, and doesn't NUL-terminate an
overlong result.  To make matters worse, it pads a short result with
zeroes, which is a performance disaster if you have big buffers.

strlcpy(), by contrast, is a mis-designed "fix" for strlcpy(), lacking
the insane NUL padding, but having a differently broken return value
which returns the original length of the source string.  Which means
that it will read characters past the count from the source buffer, and
you have to trust the source to be properly terminated.  It also makes
error handling fragile, since the test for overflow is unnecessarily
subtle.

strscpy() avoids both these problems, guaranteeing the NUL termination
(but not excessive padding) if the destination size wasn't zero, and
making the overflow condition very obvious by returning -E2BIG.  It also
doesn't read past the size of the source, and can thus be used for
untrusted source data too.

So why did I waffle about this for so long?

Every time we introduce a new-and-improved interface, people start doing
these interminable series of trivial conversion patches.

And every time that happens, somebody does some silly mistake, and the
conversion patch to the improved interface actually makes things worse.
Because the patch is mindnumbing and trivial, nobody has the attention
span to look at it carefully, and it's usually done over large swatches
of source code which means that not every conversion gets tested.

So I'm pulling the strscpy() support because it *is* a better interface.
But I will refuse to pull mindless conversion patches.  Use this in
places where it makes sense, but don't do trivial patches to fix things
that aren't actually known to be broken.

* 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
  tile: use global strscpy() rather than private copy
  string: provide strscpy()
  Make asm/word-at-a-time.h available on all architectures
2015-10-04 16:31:13 +01:00
..
native ia64: remove paravirt code 2015-06-10 14:26:32 -07:00
sn ia64: Replace __get_cpu_var uses 2014-08-26 13:45:52 -04:00
uv ia64: Replace __get_cpu_var uses 2014-08-26 13:45:52 -04:00
Kbuild Merge branch 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2015-10-04 16:31:13 +01:00
acenv.h ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion. 2014-07-23 01:10:44 +02:00
acpi-ext.h ACPI: remove private acpica headers from driver files 2008-12-31 01:15:22 -05:00
acpi.h ia64: fix up obsolete cpu function usage. 2015-03-05 15:25:04 +10:30
agp.h agp: kill phys_to_gart() and gart_to_phys() 2009-08-03 09:05:00 +01:00
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
asmmacro.h Rename .data..patch.XXX to .data..patch.XXX. 2010-03-03 11:25:59 +01:00
atomic.h atomic: Provide atomic_{or,xor,and} 2015-07-27 14:06:24 +02:00
barrier.h locking, arch: use WRITE_ONCE()/READ_ONCE() in smp_store_release()/smp_load_acquire() 2015-08-03 10:59:30 +02:00
bitops.h arch,ia64: Convert smp_mb__*() 2014-04-18 14:20:35 +02:00
bug.h
bugs.h
cache.h Rename .data.read_mostly to .data..read_mostly. 2010-03-03 11:26:00 +01:00
cacheflush.h block: add helpers to run flush_dcache_page() against a bio and a request's pages 2009-11-26 09:16:19 +01:00
checksum.h
clocksource.h clocksource: Change __ARCH_HAS_CLOCKSOURCE_DATA to a CONFIG option 2011-07-21 13:34:05 -07:00
cpu.h
cputime.h cputime: Generic on-demand virtual cputime accounting 2013-01-27 19:23:27 +01:00
current.h
cyclone.h
delay.h
device.h driver core / ACPI: Move ACPI support to core device and driver types 2012-11-15 00:28:00 +01:00
div64.h
dma-mapping.h dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
dma.h
dmi.h firmware/dmi_scan: generalize for use by other archs 2014-01-23 16:36:57 -08:00
elf.h default SET_PERSONALITY() in linux/elf.h 2013-02-26 02:46:08 -05:00
emergency-restart.h
esi.h
fb.h
fpswa.h
ftrace.h [IA64] sanity in #include files. Move fnptr to types.h 2010-01-06 15:52:35 -08:00
futex.h Wrong asm register contraints in the futex implementation 2013-03-19 16:14:53 -07:00
gcc_intrin.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
gpio.h gpiolib/arches: Centralise bolierplate asm/gpio.h 2012-05-11 18:00:14 -06:00
hardirq.h [IA64] Move local_softirq_pending() definition 2010-10-19 13:31:11 +02:00
hpsim.h hpsim, initialize chip for assigned irqs 2012-03-08 12:26:30 -08:00
hugetlb.h mm/hugetlb: remove arch_prepare/release_hugepage from arch headers 2015-06-25 17:00:35 -07:00
hw_irq.h ia64: remove paravirt code 2015-06-10 14:26:32 -07:00
idle.h [IA64] xen_domu_defconfig: fix build issues/warnings 2009-05-05 11:43:13 -07:00
intrinsics.h ia64: remove paravirt code 2015-06-10 14:26:32 -07:00
io.h arch: introduce memremap() 2015-08-14 13:23:28 -04:00
iommu.h iommu: Remove group_mf 2012-06-25 13:48:30 +02:00
iommu_table.h ia64, iommu: Add a dummy iommu_table.h file in IA64. 2010-10-08 13:11:11 -07:00
iosapic.h ia64: remove paravirt code 2015-06-10 14:26:32 -07:00
irq.h genirq: Make create/destroy_irq() ia64 private 2014-05-16 14:05:21 +02:00
irq_regs.h
irq_remapping.h iommu/vt-d: Refine the interfaces to create IRQ for DMAR unit 2015-04-24 15:36:49 +02:00
irqflags.h [IA64] Fix include dependency in asm/irqflags.h 2013-06-17 13:39:52 -07:00
kdebug.h
kexec.h Disintegrate asm/system.h for IA64 2012-03-28 18:30:02 +01:00
kmap_types.h kmap_types: make most arches use generic header file 2009-06-16 19:47:51 -07:00
kprobes.h [IA64] sanity in #include files. Move fnptr to types.h 2010-01-06 15:52:35 -08:00
kregs.h [IA64] Fix annoying IA64_TR_ALLOC_MAX message. 2008-10-17 13:47:53 -07:00
libata-portmap.h
linkage.h consolidate cond_syscall and SYSCALL_ALIAS declarations 2013-03-03 22:55:19 -05:00
local.h
local64.h arch: Implement local64_t 2010-06-09 11:12:36 +02:00
machvec.h ia64/xen: Remove Xen support for ia64 2013-12-10 16:11:07 -08:00
machvec_dig.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
machvec_dig_vtd.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
machvec_hpsim.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
machvec_hpzx1.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
machvec_hpzx1_swiotlb.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
machvec_init.h [IA64] SN specific version of dma_get_required_mask() 2009-01-15 10:42:16 -08:00
machvec_sn2.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
machvec_uv.h [IA64] Rename platform_name to ia64_platform_name 2012-07-25 11:47:16 -07:00
mc146818rtc.h
mca.h Fix initialization of CMCI/CMCP interrupts 2013-04-02 09:37:06 -07:00
mca_asm.h Disintegrate asm/system.h for IA64 2012-03-28 18:30:02 +01:00
meminit.h ia64/xen: Remove Xen support for ia64 2013-12-10 16:11:07 -08:00
mman.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
mmu.h
mmu_context.h cpumask: use mm_cpumask() wrapper: ia64 2009-03-16 14:12:48 +10:30
mmzone.h [IA64] removing redundant ifdef 2010-05-18 14:45:52 -07:00
module.h ia64: remove paravirt code 2015-06-10 14:26:32 -07:00
msidef.h ia64: Move the macro definitions related to MSI to one header file. 2009-03-24 11:03:12 +02:00
mutex.h arch: Make __mutex_fastpath_lock_retval return whether fastpath succeeded or not 2013-06-26 12:10:55 +02:00
nodedata.h
numa.h Fix build error for numa_clear_node() under IA64 2013-04-02 09:39:48 -07:00
page.h ia64: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pal.h Fix common misspellings 2011-03-31 11:26:23 -03:00
param.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
parport.h IA64: drivers: remove __dev* attributes. 2013-01-03 15:57:13 -08:00
patch.h
pci.h Merge branch 'for-4.2/sg' of git://git.kernel.dk/linux-block 2015-06-25 15:22:36 -07:00
percpu.h [IA64] Update comment that references __get_cpu_var 2014-12-02 11:22:07 -08:00
perfmon.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
pgalloc.h ia64: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pgtable.h ia64: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
processor.h sched, mips, ia64: Remove __ARCH_WANT_UNLOCKED_CTXSW 2014-09-24 14:47:05 +02:00
ptrace.h new helper: current_user_stack_pointer() 2012-12-19 18:07:39 -05:00
rwsem.h rwsem: Move duplicate function prototypes to linux/rwsem.h 2011-01-27 12:30:39 +01:00
sal.h Disintegrate asm/system.h for IA64 2012-03-28 18:30:02 +01:00
sections.h ia64: remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[] 2014-10-14 02:18:28 +02:00
segment.h
serial.h
shmparam.h
siginfo.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
signal.h consolidate kernel-side struct sigaction declarations 2013-02-03 15:09:22 -05:00
smp.h IA64: drivers: remove __dev* attributes. 2013-01-03 15:57:13 -08:00
sparsemem.h
spinlock.h lockref: Implement lockref for Itanium 2013-09-04 17:18:56 -07:00
spinlock_types.h locking: Convert raw_rwlock to arch_rwlock 2009-12-14 23:55:32 +01:00
string.h
swiotlb.h swiotlb: Remove duplicate swiotlb_force extern declarations 2009-11-15 09:03:10 +01:00
switch_to.h ia64: Replace __get_cpu_var uses 2014-08-26 13:45:52 -04:00
syscall.h ARCH: AUDIT: implement syscall_get_arch for all arches 2014-09-23 16:20:10 -04:00
termios.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
thread_info.h arch: Remove exec_domain from remaining archs 2015-04-12 21:03:30 +02:00
timex.h ia64/pv_ops/pv_time_ops: add sched_clock hook. 2009-03-26 10:50:42 -07:00
tlb.h mm: split 'tlb_flush_mmu()' into tlb flushing and memory freeing parts 2014-04-25 16:05:40 -07:00
tlbflush.h
topology.h sched/topology: Rename topology_thread_cpumask() to topology_sibling_cpumask() 2015-05-27 15:22:15 +02:00
types.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
uaccess.h ia64: fix put_user sparse errors 2015-01-13 15:23:34 +02:00
unaligned.h
uncached.h
unistd.h ia64: Enable userfaultfd and membarrier system calls 2015-09-15 16:22:45 -07:00
unwind.h
user.h
ustack.h UAPI: (Scripted) Disintegrate arch/ia64/include/asm 2012-10-09 09:47:00 +01:00
vga.h
xor.h