WSL2-Linux-Kernel/arch/avr32/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
addrspace.h
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
asm.h
atomic.h atomic: Provide atomic_{or,xor,and} 2015-07-27 14:06:24 +02: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 arch,avr32: Convert smp_mb__*() 2014-04-18 11:40:33 +02:00
bug.h Disintegrate asm/system.h for AVR32 2012-03-28 18:30:01 +01:00
bugs.h avr32: remove cpu_data macro to fix compiles 2014-03-31 08:41:36 +02:00
cache.h dma-mapping: rename ARCH_KMALLOC_MINALIGN to ARCH_DMA_MINALIGN 2010-08-11 08:59: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 arch: Remove __ARCH_HAVE_CMPXCHG 2015-05-13 10:55:42 +02:00
current.h
dma-mapping.h avr32: use for_each_sg() 2015-06-25 17:00:37 -07:00
dma.h
elf.h avr32: fix integer overflow in ELF_ET_DYN_BASE 2015-04-13 18:48:55 +02:00
fb.h
ftrace.h tracing: make CALLER_ADDRx overwriteable 2009-03-02 16:49:37 -05:00
gpio.h avr32: Use <mach/foo.h> instead of <asm/arch/foo.h> 2008-08-05 14:36:57 +02:00
hardirq.h avr32: convert to asm-generic/hardirq.h 2009-12-14 19:24:28 +01:00
hw_irq.h avr32: remove obsolete hw_interrupt_type 2009-05-13 16:53:48 +02:00
io.h arch/*/io.h: Add ioremap_uc() to all architectures 2015-07-29 10:02:36 +02:00
irq.h avr32: Use <mach/foo.h> instead of <asm/arch/foo.h> 2008-08-05 14:36:57 +02:00
irqflags.h Fix IRQ flag handling naming 2010-10-07 14:08:55 +01:00
kdebug.h avr32: Define DIE_OOPS 2009-01-07 10:40:30 +01:00
kmap_types.h avr32: remove km_type definitions 2012-07-24 15:27:30 +08:00
kprobes.h avr32: add kprobe_ctlblk memory struct 2013-11-20 09:53:22 +01:00
linkage.h
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
ocd.h
page.h
pci.h
pgalloc.h avr32: handle pgtable_page_ctor() fail 2013-11-15 09:32:17 +09:00
pgtable-2level.h
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 missing user_stack_pointer() instances 2012-12-19 18:07:39 -05:00
serial.h
setup.h UAPI: (Scripted) Disintegrate arch/avr32/include/asm 2012-10-10 12:09:31 +01:00
shmparam.h
signal.h consolidate kernel-side struct sigaction declarations 2013-02-03 15:09:22 -05:00
string.h
switch_to.h sched, avr32: Remove finish_arch_switch() 2015-08-04 09:38:03 +02:00
syscalls.h avr32: make architecture sys_clone prototype match asm-generic prototype 2011-01-13 20:41:06 +01:00
sysreg.h
termios.h UAPI: (Scripted) Disintegrate arch/avr32/include/asm 2012-10-10 12:09:31 +01: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
traps.h
types.h UAPI: (Scripted) Disintegrate arch/avr32/include/asm 2012-10-10 12:09:31 +01:00
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
unaligned.h
unistd.h avr32: wire up missing syscalls 2015-02-09 15:27:44 +01:00
user.h