1
0
Fork 0
alistair23-linux/arch/mips
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
..
alchemy genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
ar7 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
ath25 genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
ath79 MIPS: ATH79: Add irq chip ar7240-misc-intc 2015-09-22 19:07:11 +02:00
bcm47xx Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
bcm63xx MIPS: bcm63xx: Use irq_set_handler_locked() 2015-08-26 15:23:29 +02:00
bmips mips/irq: prepare for drivers/irqchip/irqchip.h removal 2015-07-31 20:51:21 +02:00
boot lib/decompressors: use real out buf size for gunzip with kernel 2015-09-10 13:29:01 -07:00
cavium-octeon MIPS: Octeon: Fix kernel panic on startup from memory corruption 2015-10-02 19:19:55 +02:00
cobalt MIPS: Cobalt Don't use module_init in non-modular MTD registration. 2015-06-21 22:14:30 +02:00
configs Yama: remove needless CONFIG_SECURITY_YAMA_STACKED 2015-07-28 13:18:19 +10:00
dec MIPS: DEC: Do not set up the FPU interrupt if no FPU 2015-04-08 01:10:46 +02:00
emma MIPS: Remove panic_timeout settings 2013-11-26 12:12:27 +01:00
fw MIPS: ARC: Use __noreturn / unreachable in ARC termination functions. 2015-01-13 16:04:27 +01:00
include Merge branch 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2015-10-04 16:31:13 +01:00
jazz MIPS: Jazz: Migrate to new 'set-state' interface 2015-09-03 12:07:50 +02:00
jz4740 MIPS: Fix the build on jz4740 after removing the custom gpio.h 2015-10-01 09:06:26 +02:00
kernel MIPS: scall: Always run the seccomp syscall filters 2015-10-04 12:10:56 +02:00
kvm KVM: add halt_attempted_poll to VCPU stats 2015-09-16 12:17:00 +02:00
lantiq MIPS: Export get_c0_perfcount_int() 2015-08-03 09:25:18 +02:00
lasat MIPS: Lasat: Move from deprecated __initcall to arch_initcall. 2015-09-03 12:07:49 +02:00
lib MIPS: Rearrange ENTRYLO field definitions 2015-09-03 12:07:48 +02:00
loongson32 MIPS: loongsoon32: Migrate to new 'set-state' interface 2015-09-03 12:07:53 +02:00
loongson64 MIPS: Fix console output for Fulong2e system 2015-09-22 17:25:33 +02:00
math-emu MIPS: math-emu: Remove unused handle_dsemul function declaration 2015-09-03 12:08:15 +02:00
mm MIPS: dma-default: Fix 32-bit fall back to GFP_DMA 2015-09-30 16:27:39 +02:00
mti-malta MIPS: malta: Use generic platform_maar_init 2015-09-03 12:07:41 +02:00
mti-sead3 MIPS: Export get_c0_perfcount_int() 2015-08-03 09:25:18 +02:00
net MIPS: BPF: Fix load delay slots. 2015-10-02 09:48:57 +02:00
netlogic genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
oprofile MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
paravirt MIPS: SMP: Don't increment irq_count multiple times for call function IPIs 2015-08-03 09:25:12 +02:00
pci PCI updates for v4.3: 2015-09-25 11:16:53 -07:00
pistachio MIPS: pistachio: Allow to enable the external timer based clocksource 2015-09-03 12:08:07 +02:00
pmcs-msp71xx MIPS: irq: Use access helper irq_data_get_affinity_mask() 2015-08-26 15:23:28 +02:00
pnx833x MIPS: PNX833x: Remove checks for CONFIG_I2C_PNX0105 2014-05-23 15:12:39 +02:00
power MIPS: Hibernate: flush TLB entries earlier 2015-04-10 15:41:52 +02:00
ralink genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
rb532 MIPS: Remove all the uses of custom gpio.h 2015-09-03 12:08:02 +02:00
sgi-ip22 MIPS: ip22-gio: Remove legacy suspend/resume support 2015-02-20 13:30:55 +01:00
sgi-ip27 MIPS: IP27: Migrate to new 'set-state' interface 2015-09-03 12:07:54 +02:00
sgi-ip32 MIPS: IP32: Fix build errors in reset code in DS1685 platform hook. 2015-05-13 00:01:41 +02:00
sibyte MIPS: Sibyte: Move bus watcher from deprecated __initcall to device_initcall 2015-09-03 12:07:49 +02:00
sni MIPS: sni: Migrate to new 'set-state' interface 2015-09-03 12:07:54 +02:00
txx9 MIPS: Remove all the uses of custom gpio.h 2015-09-03 12:08:02 +02:00
vr41xx MIPS/IRQCHIP: Move irq_chip from arch/mips to drivers/irqchip. 2015-06-21 21:52:50 +02:00
Kbuild MIPS: net: Add BPF JIT 2014-05-30 16:10:20 +02:00
Kbuild.platforms MIPS: Loongson: Naming style cleanup and rework 2015-06-21 21:53:59 +02:00
Kconfig kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00
Kconfig.debug MIPS: Drop CONFIG_RUNTIME_DEBUG & debug.h 2015-08-26 15:23:36 +02:00
Makefile MIPS: SB1: Remove support for Pass 1 parts. 2015-07-14 21:47:34 +02:00