WSL2-Linux-Kernel/drivers/of/unittest-data
Frank Rowand 29acfb6559 of: unittest: kmemleak in duplicate property update
kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 5 of 5.

When overlay 'overlay_bad_add_dup_prop' is applied, the apply code
properly detects that a memory leak will occur if the overlay is removed
since the duplicate property is located in a base devicetree node and
reports via printk():

  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail
  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail

The overlay is removed when the apply code detects multiple changesets
modifying the same property.  This is reported via printk():

  OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail

As a result of this error, the overlay is removed resulting in the
expected memory leak.

Add another device node level to the overlay so that the duplicate
property is located in a node added by the overlay, thus no memory
leak will occur when the overlay is removed.

Thus users of kmemleak will not have to debug this leak in the future.

Fixes: 2fe0e8769d ("of: overlay: check prevents multiple fragments touching same property")
Reported-by: Erhard F. <erhard_f@mailbox.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2020-04-17 08:31:34 -05:00
..
Makefile
overlay.dts
overlay_0.dts
overlay_1.dts
overlay_2.dts
overlay_3.dts
overlay_4.dts
overlay_5.dts
overlay_6.dts
overlay_7.dts
overlay_8.dts
overlay_9.dts
overlay_10.dts
overlay_11.dts
overlay_12.dts
overlay_13.dts
overlay_15.dts
overlay_bad_add_dup_node.dts
overlay_bad_add_dup_prop.dts of: unittest: kmemleak in duplicate property update 2020-04-17 08:31:34 -05:00
overlay_bad_phandle.dts
overlay_bad_symbol.dts
overlay_base.dts
overlay_gpio_01.dts
overlay_gpio_02a.dts
overlay_gpio_02b.dts
overlay_gpio_03.dts
overlay_gpio_04a.dts
overlay_gpio_04b.dts
testcases.dts
tests-address.dtsi
tests-interrupts.dtsi
tests-match.dtsi
tests-overlay.dtsi
tests-phandle.dtsi
tests-platform.dtsi