linux/arch/m68k
Linus Torvalds 7c08461253 m68k: remove broken strcmp implementation
The m68 hand-written assembler version of strcmp() has always been
broken: it returns the difference between the first non-matching byte
done as a 8-bit subtraction.

That is _almost_ right, but is broken for the overflow case.  The
strcmp() function should indeed return the sign of the difference
between the first byte that differs, but the subtraction needs to be
done in a wider type than 'char'.  Otherwise the ordering isn't actually
stable.

This went unnoticed for basically forever, because nobody ever cares
about non-US-ASCII orderings in the kernel (in fact, most users only
care about "exact match or not"), so overflows don't really happen in
practice, even if it was very very wrong.

But that mostly unnoticeable bug becomes very noticeable by the recent
change to make 'char' be unsigned in the kernel across all architectures
(commit 3bc753c06d: "kbuild: treat char as always unsigned"). Because
the code not only did the subtraction in the wrong type width, it also
used 'char' to then make the compiler expand the result from an 8-bit
difference to the 'int' return value.

So now with an unsigned char that incorrect arithmetic width was then
not even sign-expanded, and always returned just a positive integer.

We could re-instate the old broken code by just turning the 'char' into
'signed char' as has been done elsewhere where people depended on the
signedness of 'char', but since the whole function was broken to begin
with, and we have a non-broken default fallback implementation, let's
just remove this broken function entirely.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/lkml/20221221145332.GA2399037@roeck-us.net/
Cc: Jason Donenfeld <Jason@zx2c4.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-12-21 08:56:43 -08:00
..
68000 m68knommu: updates and fixes for v6.1 2022-10-10 14:19:05 -07:00
amiga m68k: Add asm/config.h 2022-02-21 12:00:20 +01:00
apollo m68k: Add asm/config.h 2022-02-21 12:00:20 +01:00
atari for-5.18/block-2022-03-18 2022-03-21 16:48:55 -07:00
bvme6000 for-5.18/block-2022-03-18 2022-03-21 16:48:55 -07:00
coldfire kbuild: use obj-y instead extra-y for objects placed at the head 2022-10-02 18:04:05 +09:00
configs m68k: defconfig: Update defconfigs for v6.1-rc1 2022-11-14 14:56:11 +01:00
emu tty: nfcon: use console_is_registered() 2022-12-02 11:25:01 +01:00
fpsp040 signal/m68k: Use force_sigsegv(SIGSEGV) in fpsp040_die 2021-08-26 09:59:15 -05:00
hp300 m68k: removed unused "mach_get_ss" 2022-05-25 00:04:11 +10:00
ifpsp060 m68k: fpsp040,ifpsp060: Remove meaningless EXTRA_LDFLAGS 2021-04-06 09:33:20 +02:00
include m68k: remove broken strcmp implementation 2022-12-21 08:56:43 -08:00
kernel m68knommu: updates and fixes for v6.2 2022-12-20 08:56:35 -06:00
lib net: unexport csum_and_copy_{from,to}_user 2022-04-29 14:37:59 -07:00
mac m68k: mac: Reword comment using double "in" 2022-11-01 12:17:56 +01:00
math-emu m68k: math-emu: Fix typos in comments 2022-05-09 13:13:59 +02:00
mm m68k/mm: enable ARCH_HAS_VM_GET_PAGE_PROT 2022-07-17 17:14:40 -07:00
mvme16x for-5.18/block-2022-03-18 2022-03-21 16:48:55 -07:00
mvme147 for-5.18/block-2022-03-18 2022-03-21 16:48:55 -07:00
q40 This was a moderately busy cycle for documentation, but nothing all that 2022-08-02 19:24:24 -07:00
sun3 m68k: sun3: Use __func__ to get function's name in an output message 2022-06-20 14:16:43 +02:00
sun3x m68k: Remove set_fs() 2021-09-24 13:35:07 +02:00
tools/amiga
virt m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED 2022-09-28 22:16:44 +02:00
install.sh kbuild: factor out the common installation code into scripts/install.sh 2022-05-11 21:45:53 +09:00
Kbuild m68k: Introduce a virtual m68k machine 2022-04-11 11:48:01 +02:00
Kconfig m68k: Allow kexec on M68KCLASSIC with MMU enabled only 2022-09-19 10:40:58 +02:00
Kconfig.bus m68k: coldfire: drop ISA_DMA_API support 2022-05-16 13:18:30 +10:00
Kconfig.cpu - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
Kconfig.debug m68k: Kconfig.debug: Replace single quotes 2022-07-06 14:07:04 +02:00
Kconfig.devices
Kconfig.machine m68k: Kconfig.machine: Add endif comment 2022-07-06 14:07:04 +02:00
Makefile kbuild: remove head-y syntax 2022-10-02 18:06:03 +09:00