From: Zbigniew Jędrzejewski-Szmek Date: Thu, 1 Apr 2021 08:53:42 +0000 (+0200) Subject: shared/dissect-image: silence gcc warning X-Git-Tag: v249-rc1~486^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f8fb21c42a7b05a0775d50bc9b6680ddaa83e16;p=thirdparty%2Fsystemd.git shared/dissect-image: silence gcc warning --- diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 70739412a2f..fabf3b2e2ec 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -486,7 +486,8 @@ int dissect_image( #ifdef GPT_USR_NATIVE sd_id128_t usr_uuid = SD_ID128_NULL, usr_verity_uuid = SD_ID128_NULL; #endif - bool is_gpt, is_mbr, generic_rw, multiple_generic = false; + bool is_gpt, is_mbr, multiple_generic = false, + generic_rw = false; /* initialize to appease gcc */ _cleanup_(sd_device_unrefp) sd_device *d = NULL; _cleanup_(dissected_image_unrefp) DissectedImage *m = NULL; _cleanup_(blkid_free_probep) blkid_probe b = NULL; @@ -494,7 +495,7 @@ int dissect_image( sd_id128_t generic_uuid = SD_ID128_NULL; const char *pttype = NULL, *sysname = NULL; blkid_partlist pl; - int r, generic_nr, n_partitions; + int r, generic_nr = -1, n_partitions; struct stat st; usec_t deadline; @@ -1202,6 +1203,7 @@ int dissect_image( return -ENOMEM; } + assert(generic_nr >= 0); m->partitions[PARTITION_ROOT] = (DissectedPartition) { .found = true, .rw = generic_rw,