aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Scull <ascull@google.com>2022-04-03 10:39:15 +0000
committerTom Rini <trini@konsulko.com>2022-04-29 11:11:36 -0400
commitd69616e529560ace8cdf40bda91464a88c7ff43a (patch)
treef830de0295223e3d938244e60e80a89cdc7f3e91
parent7f58feae3fba07c349fe57e86ce8bd5cc2198f58 (diff)
downloadu-boot-WIP/2022-04-29-fuzzing-and-asan-fixes.zip
u-boot-WIP/2022-04-29-fuzzing-and-asan-fixes.tar.gz
u-boot-WIP/2022-04-29-fuzzing-and-asan-fixes.tar.bz2
test: dm: devres: Remove use-after-freeWIP/2022-04-29-fuzzing-and-asan-fixes
Use-after-free shouldn't be used, even in tests. It's bad practice and makes the test brittle. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/dm/devres.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/test/dm/devres.c b/test/dm/devres.c
index 4f959d1..524114c 100644
--- a/test/dm/devres.c
+++ b/test/dm/devres.c
@@ -178,11 +178,8 @@ static int dm_test_devres_phase(struct unit_test_state *uts)
ut_asserteq(1, stats.allocs);
ut_asserteq(TEST_DEVRES_SIZE, stats.total_size);
- /* Unbinding removes the other. Note this access a freed pointer */
+ /* Unbinding removes the other. */
device_unbind(dev);
- devres_get_stats(dev, &stats);
- ut_asserteq(0, stats.allocs);
- ut_asserteq(0, stats.total_size);
return 0;
}