Skip to contentSkip to conversation

gfs2_fsck: Fix undefined operation warnings

PATCH New Andrew Price 1 participant 2 messages Apr 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2_fsck: Fix undefined operation warnings

Occurrences of *ptr++ made gcc throw up "operation on 'ptr' may be undefined" warnings. This patch adds parentheses to make the order of evaluation explicit.

---
 gfs2/fsck/fs_recovery.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
gfs2/fsck/fs_recovery.c +3 -3
index 3b25dc6..573152e 100644
@@ -125,7 +125,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 		sd_found_metablocks++;
 
-		blkno = be64_to_cpu(*ptr++);
+		blkno = be64_to_cpu((*ptr)++);
 		if (gfs2_revoke_check(sdp, blkno, start))
 			continue;
 
@@ -218,8 +218,8 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 	gfs2_replay_incr_blk(ip, &start);
 	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
-		blkno = be64_to_cpu(*ptr++);
-		esc = be64_to_cpu(*ptr++);
+		blkno = be64_to_cpu((*ptr)++);
+		esc = be64_to_cpu((*ptr)++);
 
 		sd_found_jblocks++;
 
Signature · 1 line
1.5.4.4
#1 lore raw

PATCH 1/1 gfs2_fsck: Fix undefined operation warnings

Sorry, don't apply this one. I misunderstood the context.

Quoted 33 lines · Andrew Price

Occurrences of *ptr++ made gcc throw up "operation on 'ptr' may be undefined" warnings. This patch adds parentheses to make the order of evaluation explicit.

---
 gfs2/fsck/fs_recovery.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
gfs2/fsck/fs_recovery.c +3 -3
index 3b25dc6..573152e 100644
@@ -125,7 +125,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 		sd_found_metablocks++;
 
-		blkno = be64_to_cpu(*ptr++);
+		blkno = be64_to_cpu((*ptr)++);
 		if (gfs2_revoke_check(sdp, blkno, start))
 			continue;
 
@@ -218,8 +218,8 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 	gfs2_replay_incr_blk(ip, &start);
 	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
-		blkno = be64_to_cpu(*ptr++);
-		esc = be64_to_cpu(*ptr++);
+		blkno = be64_to_cpu((*ptr)++);
+		esc = be64_to_cpu((*ptr)++);
 
 		sd_found_jblocks++;