kernel_samsung_a53x/drivers/mtd/nand/raw
Arnd Bergmann 354575a8be mtd: diskonchip: work around ubsan link failure
commit 21c9fb611c25d5cd038f6fe485232e7884bb0b3d upstream.

I ran into a randconfig build failure with UBSAN using gcc-13.2:

arm-linux-gnueabi-ld: error: unplaced orphan section `.bss..Lubsan_data31' from `drivers/mtd/nand/raw/diskonchip.o'

I'm not entirely sure what is going on here, but I suspect this has something
to do with the check for the end of the doc_locations[] array that contains
an (unsigned long)0xffffffff element, which is compared against the signed
(int)0xffffffff. If this is the case, we should get a runtime check for
undefined behavior, but we instead get an unexpected build-time error.

I would have expected this to work fine on 32-bit architectures despite the
signed integer overflow, though on 64-bit architectures this likely won't
ever work.

Changing the contition to instead check for the size of the array makes the
code safe everywhere and avoids the ubsan check that leads to the link
error. The loop code goes back to before 2.6.12.

Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240405143015.717429-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-19 11:32:40 +01:00
..
atmel Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm47xxnflash Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
brcmnand Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpmi-nand Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ingenic Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ams-delta.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arasan-nand-controller.c mtd: rawnand: arasan: Ensure program page operations are successful 2024-11-08 11:26:18 +01:00
au1550nd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cadence-nand-controller.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cafe_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cs553x_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
davinci_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
denali.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
denali.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
denali_dt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
denali_pci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
diskonchip.c mtd: diskonchip: work around ubsan link failure 2024-11-19 11:32:40 +01:00
fsl_elbc_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl_ifc_nand.c mtd: rawnand: Increment IFC_TIMEOUT_MSECS for nand controller response 2024-11-18 12:12:20 +01:00
fsl_upm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsmc_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hisi504_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
internals.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lpc32xx_mlc.c mtd: rawnand: lpc32xx_mlc: fix irq handler prototype 2024-11-19 08:44:54 +01:00
lpc32xx_slc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
marvell_nand.c mtd: rawnand: marvell: Ensure program page operations are successful 2024-11-08 11:26:18 +01:00
meson_nand.c mtd: rawnand: meson: fix scrambling mode value in command macro 2024-11-19 09:22:16 +01:00
mpc5121_nfc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtk_ecc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtk_ecc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtk_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxc_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxic_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_amd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_base.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_bbt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_bch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_ecc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_esmt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_hynix.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_ids.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_jedec.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_legacy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_macronix.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_micron.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_onfi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_samsung.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_timings.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nand_toshiba.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nandsim.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ndfc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_elm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
orion_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
oxnas_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pasemi_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qcom_nandc.c mtd: rawnand: qcom: Unmap the right resource upon probe failure 2024-11-08 11:26:18 +01:00
r852.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r852.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
s3c2410.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sh_flctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sharpsl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sm_common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sm_common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
socrates_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stm32_fmc2_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sunxi_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tango_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tegra_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tmio_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
txx9ndfmc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vf610_nfc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xway_nand.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00