of: unittest: re-implement overlay tracking
authorFrank Rowand <frank.rowand@sony.com>
Sat, 1 Jan 2022 03:33:29 +0000 (21:33 -0600)
committerRob Herring <robh@kernel.org>
Wed, 5 Jan 2022 01:23:06 +0000 (19:23 -0600)
commitcca549335f5e00d2c716908d112a6b9366fa263d
treecb5cf36da54730a91787d679b7cf3c9686d8ebb6
parent137b1566c5012dc8dbcaa492afd15be3517b6332
of: unittest: re-implement overlay tracking

Some overlays are tracked when they are applied.  The tracked overlays
are later removed after the overlay tests are completed.  The old
implementation makes assumptions about the expected values for
overlay changeset id created by the overlay apply which result
in fragile code.  The new code removes the assumptions.

A symptom that exposes a problem with the tracking code is a
warning "UBSAN: shift-out-of-bounds in drivers/of/unittest.c:1933:36",
Kernel Version: 5.15-rc7, PPC-64, Talos II.  This results from variable
"id" value of -1 in the final line of of_unittest_untrack_overlay().

Reported-by: erhard_f@mailbox.org
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220101033329.1277779-3-frowand.list@gmail.com
drivers/of/unittest.c