linux/arch/c6x/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
..
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
asm-offsets.h C6X: headers 2011-10-06 19:48:20 -04:00
bitops.h arch,c6x: Convert smp_mb__*() 2014-04-18 11:40:34 +02:00
bug.h Disintegrate asm/system.h for C6X 2012-03-28 18:30:02 +01:00
cache.h c6x: fix build failure caused by cache.h 2014-03-04 17:21:58 -05:00
cacheflush.h C6X: cache control 2011-10-06 19:48:10 -04:00
checksum.h C6X: library code 2011-10-06 19:48:23 -04:00
clkdev.h C6X: clocks 2011-10-06 19:48:07 -04:00
clock.h C6X: clocks 2011-10-06 19:48:07 -04:00
cmpxchg.h Disintegrate asm/system.h for C6X 2012-03-28 18:30:02 +01:00
delay.h C6X: headers 2011-10-06 19:48:20 -04:00
dma-mapping.h c6x: include: asm: dma-mapping: Add dummy dma_sync_single_range_for_device 2015-03-26 10:47:19 -04:00
dscr.h C6X: DSCR - Device State Configuration Registers 2011-10-06 19:48:36 -04:00
elf.h default SET_PERSONALITY() in linux/elf.h 2013-02-26 02:46:08 -05:00
flat.h c6x: asm: Add default flat.h according to xtensa architecture 2015-03-26 10:31:48 -04:00
ftrace.h C6X: headers 2011-10-06 19:48:20 -04:00
hardirq.h C6X: interrupt handling 2011-10-06 19:47:54 -04:00
irq.h C6X: remove dependence on legacy IRQs 2012-07-18 23:49:40 -04:00
irqflags.h add memory barrier to arch_local_irq_restore 2013-04-09 15:35:46 -04:00
linkage.h C6X: headers 2011-10-06 19:48:20 -04:00
megamod-pic.h C6X: interrupt handling 2011-10-06 19:47:54 -04:00
module.h Make most arch asm/module.h files use asm-generic/module.h 2012-09-28 14:31:03 +09:30
mutex.h C6X: headers 2011-10-06 19:48:20 -04:00
page.h C6X: headers 2011-10-06 19:48:20 -04:00
pgtable.h arch/c6x/include/asm/pgtable.h: define dummy pgprot_writecombine for !MMU 2015-03-12 18:46:08 -07:00
processor.h arch, locking: Ciao arch_mutex_cpu_relax() 2014-07-17 12:32:47 +02:00
procinfo.h C6X: headers 2011-10-06 19:48:20 -04:00
ptrace.h UAPI: (Scripted) Disintegrate arch/c6x/include/asm 2012-10-09 14:56:38 -04:00
sections.h C6X: headers 2011-10-06 19:48:20 -04:00
setup.h c6x: include: asm: setup: Include "linux/types.h" 2015-03-26 10:39:46 -04:00
soc.h C6X: general SoC support 2011-10-06 19:48:26 -04:00
special_insns.h Disintegrate asm/system.h for C6X 2012-03-28 18:30:02 +01:00
string.h C6X: headers 2011-10-06 19:48:20 -04:00
switch_to.h Disintegrate asm/system.h for C6X 2012-03-28 18:30:02 +01:00
syscall.h C6X: headers 2011-10-06 19:48:20 -04:00
syscalls.h c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone() 2012-11-28 23:43:39 -05:00
thread_info.h arch: Remove exec_domain from remaining archs 2015-04-12 21:03:30 +02:00
timer64.h C6X: time management 2011-10-06 19:47:51 -04:00
timex.h C6X: time management 2011-10-06 19:47:51 -04:00
tlb.h C6X: headers 2011-10-06 19:48:20 -04:00
traps.h C6X: build infrastructure 2011-10-06 19:48:02 -04:00
uaccess.h C6X: headers 2011-10-06 19:48:20 -04:00
unaligned.h C6X: headers 2011-10-06 19:48:20 -04:00