diff options
author | Tom Yan <tom.ty89@gmail.com> | 2021-12-19 18:30:38 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-12-20 14:50:08 +0100 |
commit | d8daed09f37bc9f8ecb9268a4e371f65aec8b24a (patch) | |
tree | d090a6cfb1be0963d91326cf7b77e0d83959b43a /src/partition | |
parent | hwdb: update for -rc3 (diff) | |
download | systemd-d8daed09f37bc9f8ecb9268a4e371f65aec8b24a.tar.xz systemd-d8daed09f37bc9f8ecb9268a4e371f65aec8b24a.zip |
repart: use real disk start/end for bar production
Partitions are not always within our aligned scope. Bar printing
involves foreign partitions as well.
Fixes #21817.
Diffstat (limited to 'src/partition')
-rw-r--r-- | src/partition/repart.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c index 895c0665d8..d08f47f2c4 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -2080,16 +2080,14 @@ static void context_bar_char_process_partition( from = p->offset; to = from + p->new_size; - assert(context->end >= context->start); - total = context->end - context->start; + assert(context->total > 0); + total = context->total; - assert(from >= context->start); - assert(from <= context->end); - x = (from - context->start) * n / total; + assert(from <= total); + x = from * n / total; - assert(to >= context->start); - assert(to <= context->end); - y = (to - context->start) * n / total; + assert(to <= total); + y = to * n / total; assert(x <= y); assert(y <= n); |