From: Hristo Venev Date: Sat, 1 Apr 2023 20:01:35 +0000 (+0300) Subject: super1: fix truncation check for journal device X-Git-Tag: mdadm-4.3~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c6f2a1dbfe17df14dd5b062fc53a60c5c387e47;p=thirdparty%2Fmdadm.git super1: fix truncation check for journal device The journal device can be smaller than the component devices. Fixes: 171e9743881e ("super1: report truncated device") Signed-off-by: Hristo Venev Signed-off-by: Jes Sorensen --- diff --git a/super1.c b/super1.c index f7020320..44d6ecad 100644 --- a/super1.c +++ b/super1.c @@ -2359,8 +2359,9 @@ static int load_super1(struct supertype *st, int fd, char *devname) if (st->minor_version >= 1 && st->ignore_hw_compat == 0 && - (dsize < (__le64_to_cpu(super->data_offset) + - __le64_to_cpu(super->size)) + ((role_from_sb(super) != MD_DISK_ROLE_JOURNAL && + dsize < (__le64_to_cpu(super->data_offset) + + __le64_to_cpu(super->size))) || dsize < (__le64_to_cpu(super->data_offset) + __le64_to_cpu(super->data_size)))) {