OpenCloudOS-Kernel/arch/frv/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 kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
atomic.h atomic: Collapse all atomic_{set,clear}_mask definitions 2015-07-27 14:06:24 +02:00
atomic_defs.h frv: Rewrite atomic implementation 2015-07-27 14:06:23 +02:00
ax88796.h
barrier.h arch: Clean up asm/barrier.h implementations using asm-generic/barrier.h 2014-01-12 10:37:15 +01:00
bitops.h frv: Rewrite atomic implementation 2015-07-27 14:06:23 +02:00
bug.h Disintegrate asm/system.h for FRV 2012-03-28 18:30:02 +01:00
bugs.h
busctl-regs.h
cache.h FRV: ARCH_KMALLOC_MINALIGN was already defined 2010-05-28 10:17:21 -07: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
cmpxchg.h Disintegrate asm/system.h for FRV 2012-03-28 18:30:02 +01:00
cpu-irqs.h
current.h
delay.h
device.h
div64.h
dm9000.h
dma-mapping.h remove <asm/scatterlist.h> 2015-05-05 13:35:39 -06:00
dma.h
elf.h default SET_PERSONALITY() in linux/elf.h 2013-02-26 02:46:08 -05:00
emergency-restart.h
fb.h
fpu.h
ftrace.h
futex.h futex: Sanitize futex ops argument types 2011-03-11 12:23:31 +01:00
gdb-stub.h frv: extend gdbstub to support more features of gdb 2010-05-25 08:07:02 -07:00
gpio-regs.h
hardirq.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
highmem.h frv: remove the second parameter of kmap_atomic_primary() 2012-07-23 14:11:22 +08:00
hw_irq.h
io.h arch/*/io.h: Add ioremap_uc() to all architectures 2015-07-29 10:02:36 +02:00
irc-regs.h
irq.h
irq_regs.h
irqflags.h Fix IRQ flag handling naming 2010-10-07 14:08:55 +01:00
kdebug.h
kmap_types.h frv: remove km_type definitions 2012-07-24 15:27:29 +08:00
linkage.h
local.h
local64.h arch: Implement local64_t 2010-06-09 11:12:36 +02:00
math-emu.h
mb-regs.h
mb86943a.h
mb93091-fpga-irqs.h
mb93093-fpga-irqs.h
mb93493-irqs.h
mb93493-regs.h
mc146818rtc.h
mem-layout.h dma-mapping: rename ARCH_KMALLOC_MINALIGN to ARCH_DMA_MINALIGN 2010-08-11 08:59:21 -07: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 FDPIC: Respect PT_GNU_STACK exec protection markings when creating NOMMU stack 2010-01-06 18:16:02 -08:00
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
perf_event.h perf, arch: Rework perf_event_index() 2011-12-21 11:01:07 +01:00
pgalloc.h mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
pgtable.h mm: add missing __PAGETABLE_{PUD,PMD}_FOLDED defines 2015-02-28 09:57:51 -08:00
processor.h frv: remove unused cpuinfo_frv and friends to fix future build error 2014-10-09 22:26:03 -04:00
ptrace.h UAPI Disintegration 2012-10-10 2012-10-13 11:22:31 +09:00
sections.h frv: remove unused inline function is_in_rom() 2015-06-25 17:00:37 -07:00
segment.h frv: macro whitespace fixes 2015-01-13 15:23:59 +02:00
serial-regs.h
serial.h
setup.h UAPI: (Scripted) Disintegrate arch/frv/include/asm 2012-10-10 12:09:42 +01:00
shmparam.h
signal.h frv: switch to generic old sigaction() 2013-02-03 18:15:55 -05:00
smp.h
spinlock.h
spr-regs.h Fix common misspellings 2011-03-31 11:26:23 -03:00
string.h lib/string.c: remove strnicmp() 2015-02-12 18:54:14 -08:00
switch_to.h Disintegrate asm/system.h for FRV 2012-03-28 18:30:02 +01:00
syscall.h FRV: Implement new-style ptrace 2009-06-11 09:01:26 -07:00
termios.h UAPI: (Scripted) Disintegrate arch/frv/include/asm 2012-10-10 12:09:42 +01:00
thread_info.h frv: Remove signal translation and exec_domain 2015-04-12 20:58:24 +02:00
timer-regs.h
timex.h
tlb.h
tlbflush.h
topology.h
types.h UAPI: (Scripted) Disintegrate arch/frv/include/asm 2012-10-10 12:09:42 +01:00
uaccess.h frv: uaccess s/might_sleep/might_fault/ 2013-05-28 09:41:07 +02:00
ucontext.h
unaligned.h
unistd.h sys_sgetmask/sys_ssetmask: add CONFIG_SGETMASK_SYSCALL 2014-06-04 16:54:14 -07:00
user.h
vga.h
virtconvert.h Fix common misspellings 2011-03-31 11:26:23 -03:00
xor.h