File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -465,7 +465,7 @@ static inline bool is_rst_area_valid(const struct RESTART_HDR *rhdr)
465
465
{
466
466
const struct RESTART_AREA * ra ;
467
467
u16 cl , fl , ul ;
468
- u32 off , l_size , file_dat_bits , file_size_round ;
468
+ u32 off , l_size , seq_bits ;
469
469
u16 ro = le16_to_cpu (rhdr -> ra_off );
470
470
u32 sys_page = le32_to_cpu (rhdr -> sys_page_size );
471
471
@@ -511,13 +511,15 @@ static inline bool is_rst_area_valid(const struct RESTART_HDR *rhdr)
511
511
/* Make sure the sequence number bits match the log file size. */
512
512
l_size = le64_to_cpu (ra -> l_size );
513
513
514
- file_dat_bits = sizeof (u64 ) * 8 - le32_to_cpu (ra -> seq_num_bits );
515
- file_size_round = 1u << (file_dat_bits + 3 );
516
- if (file_size_round != l_size &&
517
- (file_size_round < l_size || (file_size_round / 2 ) > l_size )) {
518
- return false;
514
+ seq_bits = sizeof (u64 ) * 8 + 3 ;
515
+ while (l_size ) {
516
+ l_size >>= 1 ;
517
+ seq_bits -= 1 ;
519
518
}
520
519
520
+ if (seq_bits != ra -> seq_num_bits )
521
+ return false;
522
+
521
523
/* The log page data offset and record header length must be quad-aligned. */
522
524
if (!IS_ALIGNED (le16_to_cpu (ra -> data_off ), 8 ) ||
523
525
!IS_ALIGNED (le16_to_cpu (ra -> rec_hdr_len ), 8 ))
You can’t perform that action at this time.
0 commit comments