Skip to contentSkip to conversation

jbd2: fix clang warning in recovery.c

PATCH New Theodore Ts'o 1 participant 2 messages Aug 10, 2021 Journalling layer for block devices (JBD2)

lore
Share & tools
lore

Theodore Ts'o

author maintainer
#0 lore raw

PATCH 1/2 jbd2: fix clang warning in recovery.c

Remove unused variable store which was never used.

This fix is also in e2fsprogs commit 99a2294f85f0 ("e2fsck: value stored to err is never read").

---
 fs/jbd2/recovery.c | 1 -
 1 file changed, 1 deletion(-)
fs/jbd2/recovery.c +0 -1
index 4c4209262437..ba979fcf1cd3 100644
@@ -760,7 +760,6 @@ static int do_one_pass(journal_t *journal,
 				 */
 				jbd_debug(1, "JBD2: Invalid checksum ignored in transaction %u, likely stale data\n",
 					  next_commit_ID);
-				err = 0;
 				brelse(bh);
 				goto done;
 			}
Signature · 1 line
2.31.0
author maintainer
#1 lore raw

PATCH 2/2 jbd2: clean up two gcc -Wall warnings in recovery.c

Fix a signed vs unsigned and a void * pointer arithmetic warning.

This cleanup is also in e2fsprogs commit aec460db9a93 ("e2fsck: clean up two gcc -Wall warnings in recovery.c").

---
 fs/jbd2/recovery.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/jbd2/recovery.c +3 -3
index ba979fcf1cd3..8ca3527189f8 100644
@@ -179,8 +179,8 @@ static int jbd2_descriptor_block_csum_verify(journal_t *j, void *buf)
 	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
-	tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize -
-			sizeof(struct jbd2_journal_block_tail));
+	tail = (struct jbd2_journal_block_tail *)((char *)buf +
+		j->j_blocksize - sizeof(struct jbd2_journal_block_tail));
 	provided = tail->t_checksum;
 	tail->t_checksum = 0;
 	calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
@@ -896,7 +896,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
 {
 	jbd2_journal_revoke_header_t *header;
 	int offset, max;
-	int csum_size = 0;
+	unsigned csum_size = 0;
 	__u32 rcount;
 	int record_len = 4;
 
Signature · 1 line
2.31.0