linux/drivers
Arnd Bergmann 5be39f9011 mtd: diskonchip: work around ubsan link failure
commit 21c9fb611c 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>
History 2024-05-02 16:24:49 +02:00
..
accessibility speakup: Avoid crash on very long word 2024-04-27 17:05:28 +02:00
acpi Revert "ACPI: CPPC: Use access_width over bit_width for system memory accesses" 2024-04-13 13:01:48 +02:00
amba amba: bus: fix refcount leak 2023-09-19 12:22:47 +02:00
android binder: check offset alignment in binder_get_object() 2024-04-27 17:05:28 +02:00
ata ata: sata_mv: Fix PCI device ID table declaration compilation warning 2024-04-10 16:19:41 +02:00
atm atm: idt77252: fix a memleak in open_card_ubr0 2024-02-23 08:54:57 +01:00
auxdisplay auxdisplay: hd44780: Fix potential memory leak in hd44780_remove() 2023-03-11 13:57:22 +01:00
base driver core: Introduce device_link_wait_removal() 2024-04-10 16:19:42 +02:00
bcma Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
block aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:21:15 -04:00
bluetooth Bluetooth: qca: fix NULL-deref on non-serdev suspend 2024-05-02 16:24:48 +02:00
bus bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-03-26 18:21:19 -04:00
cdrom scsi: sr: cdrom: Move cdrom_read_cdda_bpc() into the sr driver 2021-07-30 22:13:09 -04:00
char hwrng: core - Fix page fault dead lock on mmap-ed hwrng 2024-02-23 08:54:24 +01:00
clk clk: Get runtime PM before walking tree during disable_unused 2024-04-27 17:05:26 +02:00
clocksource clocksource/drivers/arm_global_timer: Fix maximum prescaler value 2024-04-10 16:18:46 +02:00
comedi comedi: vmk80xx: fix incomplete endpoint checking 2024-04-27 17:05:26 +02:00
connector net/connector: Add const qualifier to cb_id 2020-12-16 11:06:49 -08:00
counter counter: microchip-tcb-capture: Fix the use of internal GCLK logic 2023-10-19 23:05:37 +02:00
cpufreq cpufreq: brcmstb-avs-cpufreq: fix up "add check for cpufreq_cpu_get's return value" 2024-04-10 16:18:44 +02:00
cpuidle cpuidle: Avoid potential overflow in integer multiplication 2024-04-13 13:01:43 +02:00
crypto crypto: qat - resolve race condition during AER recovery 2024-04-10 16:18:35 +02:00
cxl cxl/mem: Fix shutdown order 2023-11-20 11:08:27 +01:00
dax dax/kmem: Pass valid argument to memory_group_register_static 2023-07-23 13:47:17 +02:00
dca dca: Use PTR_ERR_OR_ZERO() to simplify code 2020-05-15 16:25:20 +02:00
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2024-02-23 08:54:38 +01:00
dio drivers: dio: fix possible memory leak in dio_init() 2022-12-31 13:14:27 +01:00
dma dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA 2024-03-26 18:21:25 -04:00
dma-buf dma-buf: add dma_fence_timestamp helper 2024-02-23 08:55:10 +01:00
edac EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 14:52:32 -08:00
eisa EISA: use DEVICE_ATTR_RO() helper macro 2021-06-04 15:28:34 +02:00
extcon extcon: usbc-tusb320: Convert to i2c's .probe_new() 2023-07-23 13:47:31 +02:00
firewire firewire: core: use long bus reset on gap count error 2024-03-26 18:21:13 -04:00
firmware efivarfs: Request at most 512 bytes for variable names 2024-04-10 16:19:30 +02:00
fpga fpga: bridge: fix kernel-doc parameter description 2023-05-11 23:00:31 +09:00
fsi fsi: aspeed: Reset master errors after CFAM reset 2023-09-19 12:22:46 +02:00
gnss treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
gpio gpio: fix resource unwinding order in error path 2024-03-06 14:38:50 +00:00
gpu drm/amdgpu: Fix leak when GPU memory allocation fails 2024-05-02 16:24:48 +02:00
greybus greybus: svc: fix an error handling bug in gb_svc_hello() 2022-04-08 14:22:50 +02:00
hid HID: logitech-dj: allow mice to use all types of reports 2024-05-02 16:24:43 +02:00
hsi HSI: omap_ssi_core: Fix error handling in ssi_init() 2022-12-31 13:14:32 +01:00
hv Drivers: hv: vmbus: Fix vmbus_wait_for_unload() to scan present CPUs 2023-06-28 10:29:42 +02:00
hwmon hwmon: (amc6821) add of_match table 2024-04-10 16:18:40 +02:00
hwspinlock hwspinlock: qcom: correct MMIO max register for newer SoCs 2022-11-16 09:58:13 +01:00
hwtracing coresight: etm4x: Fix width of CCITMIN field 2024-01-25 14:52:32 -08:00
i2c i2c: i801: Avoid potential double call to gpiod_remove_lookup_table 2024-04-10 16:18:46 +02:00
i3c i3c: master: cdns: Update maximum prescaler value for i2c clock 2024-02-23 08:54:50 +01:00
idle intel_idle: Disable IBRS during long idle 2022-07-23 12:54:04 +02:00
iio iio: accel: bma400: Fix a compilation problem 2024-02-23 08:55:07 +01:00
infiniband RDMA/mlx5: Fix port number for counter query in multi-port configuration 2024-04-27 17:05:25 +02:00
input Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails 2024-04-13 13:01:44 +02:00
interconnect Revert "interconnect: Teach lockdep about icc_bw_lock order" 2024-03-06 14:38:50 +00:00
iommu iommu/vt-d: Allocate local memory for page request queue 2024-04-17 11:15:16 +02:00
ipack ipack: ipoctal: fix module reference leak 2021-09-27 17:38:49 +02:00
irqchip irqchip/gic-v3-its: Prevent double free on error 2024-05-02 16:24:48 +02:00
isdn mISDN: Update parameter type of dsp_cmx_send() 2023-08-16 18:22:01 +02:00
leds leds: sgm3140: Add missing timer cleanup and flash gpio control 2024-03-26 18:21:31 -04:00
macintosh macintosh: via-pmu-led: requires ATA to be set 2023-05-11 23:00:34 +09:00
mailbox mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt 2024-02-23 08:54:50 +01:00
mcb mcb: fix error handling for different scenarios when parsing 2023-11-28 16:56:31 +00:00
md dm integrity: fix out-of-range warning 2024-04-10 16:19:36 +02:00
media media: cec: core: remove length check of Timer Status 2024-04-17 11:15:13 +02:00
memory memory: brcmstb_dpfe: fix testing array offset after use 2023-07-23 13:47:03 +02:00
memstick memstick r592: make memstick_debug_get_tpc_name() static 2023-07-23 13:46:52 +02:00
message scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition 2023-05-24 17:36:45 +01:00
mfd mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref 2024-03-26 18:21:29 -04:00
misc mei: me: disable RPL-S on SPS and IGN firmwares 2024-04-27 17:05:28 +02:00
mmc mmc: sdhci-msm: pervent access to suspended controller 2024-05-02 16:24:48 +02:00
most most: fix control-message timeouts 2021-11-18 19:16:08 +01:00
mtd mtd: diskonchip: work around ubsan link failure 2024-05-02 16:24:49 +02:00
mux mux: gpio: Simplify code by using dev_err_probe() 2021-04-02 16:28:53 +02:00
net net: b44: set pause params only when interface is up 2024-05-02 16:24:49 +02:00
nfc NFC: trf7970a: disable all regulators on removal 2024-05-02 16:24:45 +02:00
ntb NTB: fix possible name leak in ntb_register_device() 2024-03-26 18:21:28 -04:00
nubus nubus: Partially revert proc_create_single_data() conversion 2023-07-05 18:25:05 +01:00
nvdimm nd_btt: Make BTT lanes preemptible 2023-11-20 11:08:22 +01:00
nvme drivers/nvme: Add quirks for device 126f:2262 2024-04-13 13:01:46 +02:00
nvmem nvmem: meson-efuse: fix function pointer type mismatch 2024-04-10 16:18:40 +02:00
of of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-10 16:19:42 +02:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:21:23 -04:00
parisc parisc: iosapic.c: Fix sparse warnings 2023-10-06 13:18:15 +02:00
parport parport: parport_serial: Add Brainboxes device IDs and geometry 2024-01-25 14:52:31 -08:00
pci PCI/DPC: Quirk PIO log size for Intel Ice Lake Root Ports 2024-04-10 16:19:34 +02:00
pcmcia pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:08:27 +01:00
perf perf: hisi: Fix use-after-free when register pmu fails 2023-11-20 11:08:21 +01:00
phy phy: tegra: xusb: Add API to retrieve the port number of phy 2024-04-10 16:18:40 +02:00
pinctrl pinctrl: renesas: checker: Limit cfg reg enum checks to provided IDs 2024-04-13 13:01:44 +02:00
platform platform/x86: intel-vbtn: Update tablet mode switch at end of probe 2024-04-13 13:01:48 +02:00
pnp PNP: ACPI: fix fortify warning 2024-02-23 08:54:38 +01:00
power power: supply: bq27xxx-i2c: Do not free non existing IRQ 2024-03-06 14:38:48 +00:00
powercap powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-07-23 13:46:46 +02:00
pps pps: clients: gpio: Propagate return value from pps_gpio_probe 2022-04-08 14:23:44 +02:00
ps3 powerpc/ps3: Warn on PS3 device errors 2021-06-10 21:44:58 +10:00
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 16:56:23 +00:00
pwm pwm: sti: Fix capture for st,pwm-num-chan < st,capture-num-chan 2024-03-26 18:21:18 -04:00
rapidio rapidio: devices: fix missing put_device in mport_cdev_open 2022-12-31 13:14:05 +01:00
ras RAS/CEC: Correct ce_add_elem()'s returned values 2021-04-07 11:52:26 +02:00
regulator regulator: pwm-regulator: Add validity checks in continuous .get_voltage 2024-03-01 13:21:45 +01:00
remoteproc remoteproc: stm32: fix incorrect optional pointers 2024-03-26 18:21:37 -04:00
reset reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning 2024-01-25 14:52:30 -08:00
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-02-23 08:54:24 +01:00
rtc rtc: mt6397: select IRQ_DOMAIN instead of depending on it 2024-03-26 18:21:34 -04:00
s390 s390/cio: fix race condition during online processing 2024-04-27 17:05:25 +02:00
sbus module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
scsi scsi: qla2xxx: Fix off by one in qla_edif_app_getstats() 2024-04-17 11:15:14 +02:00
sh genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
siox siox: fix possible memory leak in siox_device_add() 2022-11-26 09:24:36 +01:00
slimbus slimbus: core: Remove usage of the deprecated ida_simple_xx() API 2024-04-10 16:18:40 +02:00
soc soc: fsl: qbman: Use raw spinlock for cgr_lock 2024-04-10 16:18:42 +02:00
soundwire soundwire: stream: fix NULL pointer dereference for multi_link 2023-12-20 15:17:41 +01:00
spi spi: spi-mt65xx: Fix NULL pointer access in interrupt handler 2024-03-26 18:21:37 -04:00
spmi spmi: Add a check for remove callback when removing a SPMI driver 2023-05-11 23:00:34 +09:00
ssb bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
staging staging: vc04_services: fix information leak in create_component() 2024-04-10 16:19:32 +02:00
target scsi: target: core: Add TMF to tmr_list handling 2024-03-01 13:21:43 +01:00
tc The main MIPS changes for 5.6: 2020-01-31 11:28:31 -08:00
tee tee: optee: Fix kernel panic caused by incorrect error handling 2024-04-10 16:18:46 +02:00
thermal thermal: devfreq_cooling: Fix perf state when calculate dfc res_util 2024-04-10 16:19:37 +02:00
thunderbolt thunderbolt: Fix wake configurations after device unplug 2024-04-27 17:05:26 +02:00
tty serial: mxs-auart: add spinlock around changing cts state 2024-05-02 16:24:47 +02:00
uio uio: Fix use-after-free in uio_open 2024-01-25 14:52:31 -08:00
usb usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error 2024-04-27 17:05:28 +02:00
vdpa vdpa/mlx5: Allow CVQ size changes 2024-03-26 18:21:36 -04:00
vfio vfio/fsl-mc: Block calling interrupt handler without trigger 2024-04-10 16:19:30 +02:00
vhost vhost: Add smp_rmb() in vhost_vq_avail_empty() 2024-04-17 11:15:16 +02:00
video fbmon: prevent division by zero in fb_videomode_from_videomode() 2024-04-13 13:01:47 +02:00
virt vboxguest: Do not use devm for irq 2022-08-25 11:40:33 +02:00
virtio virtio: reenable config if freezing device failed 2024-04-13 13:01:47 +02:00
visorbus visorbus: fix error return code in visorchipset_init() 2021-06-04 15:27:26 +02:00
vlynq bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
vme vme: Fix error not catched in fake_init() 2022-12-31 13:14:30 +01:00
w1 w1: fix loop in w1_fini() 2023-07-23 13:47:20 +02:00
watchdog watchdog: stm32_iwdg: initialize default timeout 2024-03-26 18:21:33 -04:00
xen xen/events: close evtchn after mapping cleanup 2024-04-10 16:18:46 +02:00
zorro zorro: Drop useless (and hardly used) .driver member in struct zorro_dev 2021-08-05 14:37:04 +02:00
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Makefile virtio: always enter drivers/virtio/ 2021-12-22 09:32:39 +01:00