linux/arch/microblaze/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-compat.h microblaze: Copy ppc asm-compat.h for clean handling of constants in asm and C 2009-09-22 10:10:06 +02:00
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
atomic.h atomic: implement generic atomic_dec_if_positive() 2012-10-09 16:22:46 +09:00
bitops.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
bug.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
bugs.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
cache.h microblaze: Define correct L1_CACHE_SHIFT value 2010-05-06 11:21:59 +02:00
cacheflush.h microblaze: Use static inline functions in cacheflush.h 2013-06-03 11:33:23 +02:00
checksum.h microblaze: Add support for little-endian Microblaze 2010-10-21 15:51:59 +10:00
cmpxchg.h microblaze: Add missing headers caused by disintegration asm/system.h 2012-03-30 12:11:46 +02:00
cpuinfo.h microblaze: Add support for CCF 2014-01-27 11:24:55 +01:00
cputable.h microblaze: Fix problem with removing zero length files 2009-04-14 10:37:09 +02:00
current.h microblaze_mmu_v2: Add CURRENT_TASK for entry.S 2009-05-26 16:45:19 +02:00
delay.h microblaze: Change extern inline to static inline 2015-01-05 12:36:44 +01:00
div64.h microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00
dma-mapping.h dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
dma.h microblaze: Add isa_dma_bridge_buggy to dma.h 2010-05-06 11:21:58 +02:00
elf.h UAPI: (Scripted) Disintegrate arch/microblaze/include/asm 2012-12-13 14:38:55 +01:00
emergency-restart.h microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00
entry.h arch/microblaze/include/asm/entry.h: Include "linux/linkage.h" to avoid compiling issue 2014-09-09 13:10:20 +02:00
exceptions.h microblaze: Fix sparse warning - fault.c 2011-03-09 08:09:59 +01:00
fb.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
fixmap.h microblaze: use generic fixmap.h 2014-01-23 16:36:54 -08:00
flat.h microblaze: remove unused flat_stack_align() definition 2009-06-02 07:54:36 +02:00
ftrace.h ftrace: Format MCOUNT_ADDR address as type unsigned long 2015-07-20 22:30:53 -04:00
futex.h microblaze: Reversed logic in futex cmpxchg 2013-05-27 12:29:35 +02:00
gpio.h gpiolib/arches: Centralise bolierplate asm/gpio.h 2012-05-11 18:00:14 -06:00
hardirq.h irq_domain/microblaze: Convert microblaze to use irq_domains 2012-02-16 06:11:24 -07:00
highmem.h microblaze: Kill __kmap_atomic() 2013-01-03 12:47:20 +01:00
hw_irq.h microblaze: Fix problem with removing zero length files 2009-04-14 10:37:09 +02:00
io.h video/fbdev, asm/io.h: Remove ioremap_writethrough() 2015-06-07 15:28:57 +02:00
irq.h irq_domain/microblaze: Convert microblaze to use irq_domains 2012-02-16 06:11:24 -07:00
irq_regs.h microblaze_v8: headers for irq 2009-03-27 14:25:35 +01:00
irqflags.h microblaze/irqs: Do not trace arch_local_{*,irq_*} functions 2011-07-25 09:07:45 +02:00
kdebug.h microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00
kgdb.h microblaze: Declare microblaze_kgdb_break in header 2015-01-05 12:36:42 +01:00
kmap_types.h kmap_types: make most arches use generic header file 2009-06-16 19:47:51 -07:00
linkage.h microblaze: Use empty asm-generic/linkage.h 2015-01-05 12:36:39 +01:00
local.h microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00
local64.h arch: Implement local64_t 2010-06-09 11:12:36 +02:00
mmu.h microblaze: Handle TLB skip size dynamically 2012-03-23 09:28:19 +01:00
mmu_context.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
mmu_context_mm.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
module.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
mutex.h microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00
page.h mm/microblaze: clean up unused VALID_PAGE() 2013-07-03 16:07:40 -07:00
parport.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
pci-bridge.h microblaze/PCI: remove unused pci_flags 2012-02-23 20:18:57 -07: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 microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00
pgalloc.h microblaze: Change extern inline to static inline 2015-01-05 12:36:44 +01: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
prom.h of: remove HAVE_ARCH_DEVTREE_FIXUPS 2013-10-09 20:04:08 -05: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
pvr.h microblaze: Unprivileged stream instruction awareness 2011-07-25 09:13:42 +02:00
registers.h microblaze_mmu_v2: Update process creation for MMU 2009-05-26 16:45:18 +02:00
seccomp.h microblaze: use asm-generic for seccomp.h 2015-04-17 09:04:10 -04:00
sections.h microblaze: Remove duplicate declarations of _stext[] and _etext[] 2014-01-21 08:28:19 +01:00
serial.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
setup.h microblaze: Drop architecture-specific declaration of early_printk 2014-03-12 10:10:07 +01:00
shmparam.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
string.h microblaze: Guard __HAVE_ARCH macros with __KERNEL__ in string.h 2009-05-21 15:56:08 +02:00
switch_to.h Disintegrate asm/system.h for Microblaze 2012-03-28 18:30:02 +01:00
syscall.h microblaze: Use unsigned return type in do_syscall_trace_enter 2015-01-05 12:36:43 +01:00
thread_info.h microblaze: Remove signal translation and exec_domain 2015-04-12 20:58:25 +02:00
timex.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
tlb.h mmu_gather: move minimal range calculations into generic code 2014-11-17 10:12:42 +00:00
tlbflush.h microblaze: Fix TLB macros 2010-04-01 08:38:24 +02:00
topology.h of: Provide default of_node_to_nid() implementation. 2010-07-30 00:03:58 -06: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 microblaze: fall back on generic header files for the ABI 2009-07-06 10:26:50 +02:00
unaligned.h microblaze: Fix unaligned.h for endians 2011-03-09 08:09:53 +01:00
unistd.h microblaze: Wire-up execveat syscall 2015-01-05 12:36:40 +01:00
unwind.h microblaze: Add stack unwinder 2010-08-04 10:22:35 +02:00
user.h microblaze: Fix problem with removing zero length files 2009-04-14 10:37:09 +02:00
vga.h microblaze: convert all simple headers to use asm-generic 2009-07-06 10:26:55 +02:00
xor.h microblaze_v8: headers simple files - empty or redirect to asm-generic 2009-03-27 14:25:41 +01:00