android_kernel_motorola_sm6225/arch/arm
Kursad Oney 7b0e690456 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: 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 10:29:19 +01:00
..
boot ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator 2023-11-20 10:29:18 +01:00
common
configs
crypto
firmware
include ARM: cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:49:17 +02:00
kernel hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 10:48:15 +02:00
kvm
lib ARM: 9321/1: memset: cast the constant byte to unsigned char 2023-11-20 10:29:19 +01:00
mach-actions
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed
mach-at91 ARM: at91: pm: use proper compatible for sama5d2's rtc 2022-07-12 16:29:02 +02:00
mach-axxia ARM: Fix refcount leak in axxia_boot_secondary 2022-07-02 16:27:37 +02:00
mach-bcm ARM: bcm: Fix refcount leak in bcm_kona_smc_init 2022-08-25 11:15:00 +02:00
mach-berlin
mach-clps711x
mach-cns3xxx ARM: cns3xxx: Fix refcount leak in cns3xxx_init 2022-07-02 16:27:38 +02:00
mach-davinci ARM: davinci: da850-evm: Avoid NULL pointer dereference 2022-04-20 09:12:50 +02:00
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx Revert "ARM: ep93xx: fix missing-prototype warnings" 2023-09-02 09:20:23 +02:00
mach-exynos ARM: exynos: Fix refcount leak in exynos_map_pmu 2022-07-02 16:27:37 +02:00
mach-footbridge
mach-gemini
mach-highbank
mach-hisi ARM: hisi: Add missing of_node_put after of_find_compatible_node 2022-06-14 16:59:18 +02:00
mach-imx ARM: imx: Call ida_simple_remove() for ida_simple_get 2023-03-11 16:31:32 +01:00
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc18xx
mach-lpc32xx
mach-mediatek
mach-meson ARM: meson: Fix refcount leak in meson_smp_prepare_cpus 2022-07-12 16:29:02 +02:00
mach-mmp ARM: mmp: fix timer_read delay 2023-01-18 11:30:04 +01:00
mach-moxart
mach-mv78xx0
mach-mvebu
mach-mxs ARM: mxs: fix memory leak in mxs_machine_init() 2022-12-08 11:18:29 +01:00
mach-netx
mach-nomadik
mach-npcm
mach-nspire
mach-omap1 ARM: OMAP1: call platform_device_put() in error case in omap1_dm_timer_init() 2023-03-11 16:31:32 +01:00
mach-omap2 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch() 2023-09-23 10:48:10 +02:00
mach-orion5x ARM: orion5x: fix d2net gpio initialization 2023-08-11 11:45:15 +02:00
mach-oxnas
mach-picoxcell
mach-prima2
mach-pxa ARM: pxa: remove use of symbol_get() 2023-09-23 10:47:56 +02:00
mach-qcom
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx ARM: 9187/1: JIVE: fix return value of __setup handler 2022-04-15 14:15:00 +02:00
mach-s3c64xx
mach-s5pv210
mach-sa1100 treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
mach-shmobile
mach-socfpga ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE 2021-12-01 09:27:42 +01:00
mach-spear
mach-sti
mach-stm32
mach-sunxi
mach-tango
mach-tegra
mach-u300
mach-uniphier
mach-ux500
mach-versatile
mach-vexpress ARM: versatile: Add missing of_node_put in dcscb_init 2022-06-14 16:59:18 +02:00
mach-vt8500
mach-w90x900
mach-zx
mach-zynq ARM: zynq: Fix refcount leak in zynq_early_slcr_init 2023-03-11 16:31:31 +01:00
mm ARM: 8933/1: replace Sun/Solaris style flag on section directive 2023-11-08 11:22:17 +01:00
net bpf, arm: Fix register clobbering in div/mod implementation 2021-10-13 10:10:51 +02:00
nwfpe ARM: 9256/1: NWFPE: avoid compiler-generated __aeabi_uldivmod 2023-01-18 11:30:43 +01:00
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-versatile
probes ARM: 9303/1: kprobes: avoid missing-declaration warnings 2023-08-11 11:45:03 +02:00
tools
vdso
vfp
xen xen/arm: Fix race in RB-tree based P2M accounting 2022-07-07 17:35:12 +02:00
Kconfig ARM: cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:49:17 +02:00
Kconfig-nommu
Kconfig.debug ARM: fix function graph tracer and unwinder dependencies 2022-10-26 13:19:16 +02:00
Makefile ARM: 9156/1: drop cc-option fallbacks for architecture selection 2021-11-26 11:36:17 +01:00