linux/arch/score/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 score: add asm/asm-offsets.h wrapper 2009-12-12 13:08:16 +01:00
asmmacro.h
atomic.h Disintegrate asm/system.h for Score 2012-03-28 18:30:02 +01:00
bitops.h arch,score: Convert smp_mb__*() 2014-04-18 14:20:43 +02:00
bug.h Disintegrate asm/system.h for Score 2012-03-28 18:30:02 +01:00
bugs.h
cache.h
cacheflush.h score: add flush_dcahce_page and PG_dcache_dirty define 2009-12-17 18:28:31 +08:00
checksum.h Score: Implement the function csum_ipv6_magic 2013-09-26 03:46:03 +08:00
cmpxchg.h arch: Remove __ARCH_HAVE_CMPXCHG 2015-05-13 10:55:42 +02:00
current.h
delay.h score: include asm-generic/param.h in asm/delay.h. 2009-12-17 18:31:23 +08:00
device.h
div64.h
dma.h
elf.h default SET_PERSONALITY() in linux/elf.h 2013-02-26 02:46:08 -05:00
emergency-restart.h
exec.h Disintegrate asm/system.h for Score 2012-03-28 18:30:02 +01:00
fixmap.h
ftrace.h
futex.h
hardirq.h
hw_irq.h
io.h Score: The commit is for compiling successfully. 2013-09-26 03:46:03 +08:00
irq.h score: update inconsistent declare after .c was changed 2009-08-30 12:30:16 +08:00
irq_regs.h score: update inconsistent declare after .c was changed 2009-08-30 12:30:16 +08:00
irqflags.h score: lost a semicolon in asm/irqflags.h 2011-03-28 12:02:20 +08:00
kdebug.h
kmap_types.h
linkage.h score: update inconsistent declare after .c was changed 2009-08-30 12:30:16 +08:00
local.h
local64.h arch: Implement local64_t 2010-06-09 11:12:36 +02:00
mmu.h
mmu_context.h
module.h Make most arch asm/module.h files use asm-generic/module.h 2012-09-28 14:31:03 +09:30
mutex.h
page.h score: fixed pfn_valid define. 2009-12-17 18:28:31 +08:00
pci.h
percpu.h
pgalloc.h score: handle pgtable_page_ctor() fail 2013-11-15 09:32:18 +09:00
pgtable-bits.h score: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
pgtable.h mm: make FIRST_USER_ADDRESS unsigned long on all archs 2015-02-11 17:06:03 -08:00
processor.h arch, locking: Ciao arch_mutex_cpu_relax() 2014-07-17 12:32:47 +02:00
ptrace.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00
scoreregs.h
segment.h
setup.h UAPI: (Scripted) Disintegrate arch/score/include/asm 2012-12-20 10:55:33 +00:00
shmparam.h
string.h
switch_to.h sched, score: Remove finish_arch_switch() 2015-08-04 09:38:04 +02:00
syscalls.h score: switch to generic sigaltstack 2013-02-03 18:16:15 -05:00
thread_info.h arch: Remove exec_domain from remaining archs 2015-04-12 21:03:30 +02:00
timex.h
tlb.h
tlbflush.h
topology.h
uaccess.h mm/uaccess, mm/fault: Clarify that uaccess may only sleep if pagefaults are enabled 2015-05-19 08:39:14 +02:00
ucontext.h score: add missing #includes 2009-06-27 15:09:46 +02:00
unaligned.h
user.h score: update inconsistent declare after .c was changed 2009-08-30 12:30:16 +08:00