linux/arch/unicore32/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
..
assembler.h unicore32 additional architecture files: low-level lib: misc 2011-03-17 09:19:13 +08:00
barrier.h arch: Clean up asm/barrier.h implementations using asm-generic/barrier.h 2014-01-12 10:37:15 +01:00
bitops.h unicore32: fix build error for find bitops 2011-11-15 17:13:14 +08:00
bug.h UniCore32-bugfix: Remove definitions in asm/bug.h to solve difference between native and cross compiler 2012-11-09 17:30:09 +08:00
cache.h unicore32 core architecture: mm related: generic codes 2011-03-17 09:19:08 +08:00
cacheflush.h unicore32 core architecture: mm related: consistent device DMA handling 2011-03-17 09:19:09 +08:00
checksum.h unicore32 additional architecture files: low-level lib: misc 2011-03-17 09:19:13 +08:00
cmpxchg.h UniCore32-bugfix: fix mismatch return value of __xchg_bad_pointer 2012-11-09 17:30:09 +08:00
cpu-single.h unicore32 core architecture: processor and system headers 2011-03-17 09:19:06 +08:00
cputype.h unicore32 core architecture: processor and system headers 2011-03-17 09:19:06 +08:00
delay.h unicore32 additional architecture files: low-level lib: misc 2011-03-17 09:19:13 +08:00
dma-mapping.h dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
dma.h unicore32 core architecture: mm related: consistent device DMA handling 2011-03-17 09:19:09 +08:00
elf.h
fpstate.h unicore32 additional architecture files: float point handling 2011-03-17 09:19:11 +08:00
fpu-ucf64.h unicore32 additional architecture files: float point handling 2011-03-17 09:19:11 +08:00
gpio.h unicore32 io: redefine __REG(x) and re-use readl/writel funcs 2011-03-17 09:19:19 +08:00
hwcap.h unicore32 core architecture: processor and system headers 2011-03-17 09:19:06 +08:00
hwdef-copro.h Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
io.h arch:unicore32:mm: add devmem_is_allowed() to support STRICT_DEVMEM 2014-06-20 08:22:40 +08:00
irq.h unicore32: remove unused lines in arch/unicore32/include/asm/irq.h 2011-03-17 09:19:17 +08:00
irqflags.h unicore32 core architecture: interrupts ang gpio handling 2011-03-17 09:19:10 +08: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
linkage.h
memblock.h unicore32 core architecture: mm related: generic codes 2011-03-17 09:19:08 +08:00
memory.h mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h 2015-08-27 19:40:58 -04:00
mmu_context.h mm: Make arch_unmap()/bprm_mm_init() available to all architectures 2014-11-19 11:54:13 +01:00
mmu.h unicore32 core architecture: mm related: fault handling 2011-03-17 09:19:09 +08:00
mutex.h unicore32 additional architecture files: low-level lib: misc 2011-03-17 09:19:13 +08:00
page.h unicore32 core architecture: mm related: generic codes 2011-03-17 09:19:08 +08:00
pci.h PCI: Remove unused pci_dma_burst_advice() 2015-06-08 07:56:43 -05:00
pgalloc.h unicore32: handle pgtable_page_ctor() fail 2013-11-15 09:32:19 +09:00
pgtable-hwdef.h unicore32: drop pte_file()-related helpers 2015-02-10 14:30:33 -08:00
pgtable.h unicore32: drop pte_file()-related helpers 2015-02-10 14:30:33 -08:00
processor.h arch, locking: Ciao arch_mutex_cpu_relax() 2014-07-17 12:32:47 +02:00
ptrace.h arch/unicore32/include/asm/ptrace.h: add generic definition for profile_pc() 2014-06-20 08:22:38 +08:00
stacktrace.h unicore32 core architecture: process/thread related codes 2011-03-17 09:19:07 +08:00
string.h
suspend.h PM / Hibernate: Remove arch_prepare_suspend() 2011-05-24 23:35:55 +02:00
switch_to.h Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
thread_info.h unicore32: Remove signal translation and exec_domain 2015-04-12 21:03:28 +02:00
timex.h unicore32 core architecture: timer and time handling 2011-03-17 09:19:10 +08:00
tlb.h unicore32: rewrite arch-specific tlb.h to use asm-generic version 2011-03-17 09:19:21 +08:00
tlbflush.h unicore32 core architecture: mm related: consistent device DMA handling 2011-03-17 09:19:09 +08:00
traps.h unicore32 core architecture: low level entry and setup codes 2011-03-17 09:19:06 +08:00
uaccess.h Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00