kernel_samsung_a53x/arch/arm
Kursad Oney c66caabcba ARM: 9321/1: memset: cast the constant byte to unsigned char
[ Upstream commit c0e824661f443b8cab3897006c1bbc69fd0e7bc4 ]

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: 1da177e4c3f4 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 11:43:03 +01:00
..
boot ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator 2024-11-18 11:43:02 +01:00
common Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
configs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
include Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kernel Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lib ARM: 9321/1: memset: cast the constant byte to unsigned char 2024-11-18 11:43:03 +01:00
mach-actions Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-alpine Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-artpec Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-asm9260 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-aspeed Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-at91 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-axxia Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-bcm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-berlin Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-clps711x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-cns3xxx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-davinci Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-digicolor Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-dove Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ebsa110 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-efm32 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ep93xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-exynos Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-footbridge Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-gemini Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-highbank Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-hisi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-imx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-integrator Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-iop32x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ixp4xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-keystone Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-lpc18xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-lpc32xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mediatek Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-meson Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-milbeaut Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mmp Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-moxart Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mstar Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mv78xx0 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mvebu Backport mac80211 patches from linux-6.1.y 2024-06-15 16:29:20 -03:00
mach-mxs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-nomadik Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-npcm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-nspire Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-omap1 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-omap2 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-orion5x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-oxnas Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-picoxcell Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-prima2 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-pxa Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-qcom Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-rda Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-realtek Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-realview Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-rockchip Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-rpc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-s3c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-s5pv210 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-sa1100 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-shmobile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-socfpga Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-spear Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-sti Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-stm32 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-sunxi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-tango Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-tegra Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-u300 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-uniphier Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ux500 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-versatile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-vexpress Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-vt8500 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-zx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-zynq Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nwfpe Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
oprofile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-omap Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-orion Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-pxa Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-versatile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
probes Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tools Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vdso Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vfp Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xen arm64/arm: xen: enlighten: Fix KPTI checks 2024-11-18 11:42:55 +01:00
Kbuild Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig-nommu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.assembler Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.debug Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00