1
0
Fork 0
alistair23-linux/drivers/of
Vincent Whitchurch 147e3743cf of: Fix reserved-memory overlap detection
[ Upstream commit ca05f33316 ]

The reserved-memory overlap detection code fails to detect overlaps if
either of the regions starts at address 0x0.  The code explicitly checks
for and ignores such regions, apparently in order to ignore dynamically
allocated regions which have an address of 0x0 at this point.  These
dynamically allocated regions also have a size of 0x0 at this point, so
fix this by removing the check and sorting the dynamically allocated
regions ahead of any static regions at address 0x0.

For example, there are two overlaps in this case but they are not
currently reported:

	foo@0 {
	        reg = <0x0 0x2000>;
	};

	bar@0 {
	        reg = <0x0 0x1000>;
	};

	baz@1000 {
	        reg = <0x1000 0x1000>;
	};

	quux {
	        size = <0x1000>;
	};

but they are after this patch:

 OF: reserved mem: OVERLAP DETECTED!
 bar@0 (0x00000000--0x00001000) overlaps with foo@0 (0x00000000--0x00002000)
 OF: reserved mem: OVERLAP DETECTED!
 foo@0 (0x00000000--0x00002000) overlaps with baz@1000 (0x00001000--0x00002000)

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/ded6fd6b47b58741aabdcc6967f73eca6a3f311e.1603273666.git-series.vincent.whitchurch@axis.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-11-10 12:37:29 +01:00
..
unittest-data of: overlay: check prevents multiple fragments touching same property 2018-11-08 22:12:03 -08:00
Kconfig of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc 2020-02-11 04:35:25 -08:00
Makefile PCI: Move OF-related PCI functions into PCI core 2018-01-17 17:36:39 -06:00
address.c of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc 2020-02-11 04:35:25 -08:00
base.c of: restore old handling of cells_name=NULL in of_*_phandle_with_args() 2019-09-19 08:33:02 -05:00
device.c of/device.c: fix the wrong comments 2019-05-01 13:41:07 -05:00
dynamic.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
fdt.c fdt: Update CRC check for rng-seed 2019-08-27 12:27:07 +01: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 a trivial typo in a doc comment 2019-08-14 20:12:16 -06:00
kobj.c of: Fix a refcounting bug in __of_attach_node_sysfs() 2020-06-24 17:50:35 +02:00
of_mdio.c of: of_mdio: Correct loop scanning logic 2020-07-22 09:32:55 +02:00
of_net.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
of_numa.c of, numa: Validate some distance map rules 2018-11-08 12:44:34 -06:00
of_private.h of: __of_detach_node() - remove node from phandle cache 2018-12-21 12:42:36 -06:00
of_reserved_mem.c of: Fix reserved-memory overlap detection 2020-11-10 12:37:29 +01:00
overlay.c of: overlay: kmemleak in dup_and_fixup_symbol_prop() 2020-04-23 10:36:23 +02:00
pdt.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
platform.c drivers: Introduce device lookup variants by of_node 2019-07-30 13:07:41 +02:00
property.c of: property: Document that of_graph_get_endpoint_by_regs needs of_node_put 2019-04-10 09:03:03 -05:00
resolver.c of: resolver: Add of_node_put() before return and break 2019-08-12 16:52:24 -06:00
unittest.c of: unittest: kmemleak in of_unittest_overlay_high_level() 2020-04-23 10:36:23 +02:00