]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: replace redundant if check by assert() 20703/head
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Sep 2021 09:41:52 +0000 (11:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Sep 2021 12:16:00 +0000 (14:16 +0200)
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

index a540f866896a83ee5c0e677656032e1574ad5bc7..1cfbde683d4609f32d17e798549b811b6a21173b 100644 (file)
@@ -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;