linux/drivers/of
Sergey Shtylyov c7f24b7d94 of: module: add buffer overflow check in of_modalias()
commit cf7385cb26 upstream.

In of_modalias(), if the buffer happens to be too small even for the 1st
snprintf() call, the len parameter will become negative and str parameter
(if not NULL initially) will point beyond the buffer's end. Add the buffer
overflow check after the 1st snprintf() call and fix such check after the
strlen() call (accounting for the terminating NUL char).

Fixes: bc575064d6 ("of/device: use of_property_for_each_string to parse compatible strings")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/bbfc6be0-c687-62b6-d015-5141b93f313e@omp.ru
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: "Uwe Kleine-König" <ukleinek@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-05-09 09:39:41 +02:00
..
unittest-data of/address: Add support for 3 address cell bus 2025-01-23 17:15:56 +01:00
address.c of: address: Preserve the flags portion on 1:1 dma-ranges mapping 2025-01-23 17:15:56 +01:00
base.c of: Fix of_find_node_opts_by_path() handling of alias+path+options 2025-03-13 12:50:26 +01:00
device.c of: module: add buffer overflow check in of_modalias() 2025-05-09 09:39:41 +02:00
dynamic.c of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-10 16:19:42 +02:00
fdt.c of: fdt: fix off-by-one error in unflatten_dt_nodes() 2022-09-23 14:15:46 +02:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
irq.c of/irq: Fix device node refcount leakages in of_irq_init() 2025-05-02 07:44:06 +02:00
Kconfig of: net: move of_net under net/ 2022-03-08 19:12:41 +01:00
kexec.c of: kexec: Mark ima_{free,stable}_kexec_buffer() as __init 2023-09-19 12:22:30 +02:00
kobj.c of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS 2021-08-23 13:52:09 -05:00
Makefile of: net: move of_net under net/ 2022-03-08 19:12:41 +01:00
of_numa.c of, numa: Validate some distance map rules 2018-11-08 12:44:34 -06:00
of_private.h of: Move of_dma_set_restricted_buffer() into device.c 2021-08-23 06:32:02 -04:00
of_reserved_mem.c Revert "of: reserved-memory: Fix using wrong number of cells to get property 'alignment'" 2025-03-13 12:51:01 +01:00
overlay.c of: overlay: Reorder struct fragment fields kerneldoc 2023-10-19 23:05:32 +02:00
pdt.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
platform.c iommu: Drop unnecessary of_iommu.h includes 2021-06-08 14:15:46 +02:00
property.c of: property: fix typo in io-channels 2024-02-23 08:55:10 +01:00
resolver.c of: overlay: log the error cause on resolver failure 2020-03-02 11:32:44 -06:00
unittest.c of/address: Add support for 3 address cell bus 2025-01-23 17:15:56 +01:00