linux-stable/arch/arm/lib
Kursad Oney c0e824661f ARM: 9321/1: memset: cast the constant byte to unsigned char
memset() description in ISO/IEC 9899:1999 (and elsewhere) says:

	The memset function copies the value of c (converted to an
	unsigned char) into each of the first n characters of the
	object pointed to by s.

The kernel's arm32 memset does not cast c to unsigned char. This results
in the following code to produce erroneous output:

	char a[128];
	memset(a, -128, sizeof(a));

This is because gcc will generally emit the following code before
it calls memset() :

	mov   r0, r7
	mvn   r1, #127        ; 0x7f
	bl    00000000 <memset>

r1 ends up with 0xffffff80 before being used by memset() and the
'a' array will have -128 once in every four bytes while the other
bytes will be set incorrectly to -1 like this (printing the first
8 bytes) :

	test_module: -128 -1 -1 -1
	test_module: -1 -1 -1 -128

The change here is to 'and' r1 with 255 before it is used.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kursad Oney <kursad.oney@broadcom.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2023-10-05 16:15:41 +01:00
..
ashldi3.S
ashrdi3.S
backtrace-clang.S ARM: implement IRQ stacks 2021-12-03 15:11:31 +01:00
backtrace.S ARM: implement IRQ stacks 2021-12-03 15:11:31 +01:00
bitops.h locking/atomic: arm: fix sync ops 2023-06-05 09:57:13 +02:00
bswapsdi2.S
call_with_stack.S ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack() 2022-10-04 11:09:47 +01:00
changebit.S
clear_user.S
clearbit.S
copy_from_user.S ARM: memcpy: use frame pointer as unwind anchor 2021-12-03 15:11:32 +01:00
copy_page.S
copy_template.S ARM: memcpy: use frame pointer as unwind anchor 2021-12-03 15:11:32 +01:00
copy_to_user.S ARM: memcpy: use frame pointer as unwind anchor 2021-12-03 15:11:32 +01:00
csumipv6.S
csumpartial.S
csumpartialcopy.S arm: propagate the calling convention changes down to csum_partial_copy_from_user() 2020-08-20 15:45:16 -04:00
csumpartialcopygeneric.S arm: propagate the calling convention changes down to csum_partial_copy_from_user() 2020-08-20 15:45:16 -04:00
csumpartialcopyuser.S arm: propagate the calling convention changes down to csum_partial_copy_from_user() 2020-08-20 15:45:16 -04:00
delay-loop.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
delay.c
div64.S
error-inject.c ARM: 9279/1: support function error injection 2022-12-07 14:08:38 +00:00
findbit.S ARM: findbit: add unwinder information 2022-11-14 12:00:58 +00:00
getuser.S
io-readsb.S
io-readsl.S
io-readsw-armv3.S
io-readsw-armv4.S
io-writesb.S
io-writesl.S
io-writesw-armv3.S
io-writesw-armv4.S
lib1funcs.S
lshrdi3.S
Makefile ARM: 9279/1: support function error injection 2022-12-07 14:08:38 +00:00
memchr.S
memcpy.S ARM: memcpy: use frame pointer as unwind anchor 2021-12-03 15:11:32 +01:00
memmove.S ARM: memmove: use frame pointer as unwind anchor 2021-12-03 15:11:32 +01:00
memset.S ARM: 9321/1: memset: cast the constant byte to unsigned char 2023-10-05 16:15:41 +01:00
muldi3.S
putuser.S
setbit.S
strchr.S
strrchr.S
testchangebit.S locking/atomic: arm: fix sync ops 2023-06-05 09:57:13 +02:00
testclearbit.S locking/atomic: arm: fix sync ops 2023-06-05 09:57:13 +02:00
testsetbit.S locking/atomic: arm: fix sync ops 2023-06-05 09:57:13 +02:00
uaccess_with_memcpy.c arm: allow pte_offset_map[_lock]() to fail 2023-06-19 16:19:05 -07:00
ucmpdi2.S
xor-neon.c crypto: arm/xor - make vectorized C code Clang-friendly 2022-02-11 20:39:39 +11:00