Message ID | 20230401200134.6688-1-hristo@venev.name (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | super1: fix truncation check for journal device | expand |
On Sun, 02 Apr 2023, Hristo Venev wrote: > The journal device can be smaller than the component devices. > > Fixes: 171e9743881e ("super1: report truncated device") > Signed-off-by: Hristo Venev <hristo@venev.name> > --- > super1.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > 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))) You need to have extra unnecessary ( and ) in here. But that doesn't make the patch wrong. Thanks for the fix. Reviewed-by: NeilBrown <neilb@suse.de> NeilBrown > || > dsize < (__le64_to_cpu(super->data_offset) + > __le64_to_cpu(super->data_size)))) { > -- > 2.40.0 > >
On 4/2/23 19:56, NeilBrown wrote: > On Sun, 02 Apr 2023, Hristo Venev wrote: >> The journal device can be smaller than the component devices. >> >> Fixes: 171e9743881e ("super1: report truncated device") >> Signed-off-by: Hristo Venev <hristo@venev.name> >> --- >> super1.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> 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))) > > You need to have extra unnecessary ( and ) in here. But that doesn't > make the patch wrong. > Thanks for the fix. > Reviewed-by: NeilBrown <neilb@suse.de> Applied! Thanks, Jes
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)))) {
The journal device can be smaller than the component devices. Fixes: 171e9743881e ("super1: report truncated device") Signed-off-by: Hristo Venev <hristo@venev.name> --- super1.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)