1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

dissect-image: unknown/unsupported diskseq is indicated by 0, not by UINT64_MAX

At almost all places if diskseq is not supported we encode this as
diskseq zero. But in two places we got the check for that wrong,
assuming it was UINT64_MAX.

Fix that.
This commit is contained in:
Lennart Poettering 2023-02-10 16:03:46 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 32d6707dd1
commit c12a0d6dcf

View File

@ -435,7 +435,7 @@ static int make_partition_devname(
assert(nr != 0); /* zero is not a valid partition nr */
assert(ret);
if (!FLAGS_SET(flags, DISSECT_IMAGE_DISKSEQ_DEVNODE) || diskseq == UINT64_MAX) {
if (!FLAGS_SET(flags, DISSECT_IMAGE_DISKSEQ_DEVNODE) || diskseq == 0) {
/* Given a whole block device node name (e.g. /dev/sda or /dev/loop7) generate a partition
* device name (e.g. /dev/sda7 or /dev/loop7p5). The rule the kernel uses is simple: if whole
@ -499,7 +499,7 @@ static int open_partition(
return -ENXIO;
/* Also check diskseq. */
if (loop->diskseq > 0) {
if (loop->diskseq != 0) {
uint64_t diskseq;
r = fd_get_diskseq(fd, &diskseq);
@ -573,7 +573,7 @@ static int dissect_image(
* Returns -ENXIO if we couldn't find any partition suitable as root or /usr partition
* Returns -ENOTUNIQ if we only found multiple generic partitions and thus don't know what to do with that */
uint64_t diskseq = m->loop ? m->loop->diskseq : UINT64_MAX;
uint64_t diskseq = m->loop ? m->loop->diskseq : 0;
if (verity && verity->root_hash) {
sd_id128_t fsuuid, vuuid;