From f9e0bb6167766d3787d3b2c6722eb55a338ffe3c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 9 Sep 2021 11:41:52 +0200 Subject: [PATCH] dissect-image: replace redundant if check by assert() We know that the designator can only be USR or ROOT (or negative), hence let's test that with an assert here, instead of doing an if check. --- src/shared/dissect-image.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index a540f866896..1cfbde683d4 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -1414,9 +1414,10 @@ int dissect_image( /* If we found a verity setup, then the root partition is necessarily read-only. */ m->partitions[PARTITION_ROOT].rw = false; m->verity_ready = true; - } - if (verity->designator == PARTITION_USR) { + } else { + assert(verity->designator == PARTITION_USR); + if (!m->partitions[PARTITION_USR_VERITY].found || !m->partitions[PARTITION_USR].found) return -EADDRNOTAVAIL; -- 2.47.3