Skip to contentSkip to conversation

Dereference in fs/reiserfs/bitmap.c

DISCUSSION Eric Sesterhenn 2 participants 2 messages Oct 5, 2006

lore
Share & tools
lore
#0 lore raw

hi,

coverity spotted another dereference in the reiser code, which i am able to verify, but not sure how to fix:

1305 bh = sb_bread(sb, block);
1306 if (bh == NULL)
1307 reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%lu) "
1308 "reading failed", __FUNCTION__, bh->b_blocknr);

if bh is NULL, we dereference it in the warning as bh->b_blocknr. Maybe one of you guys knows what warning is useful to print in this case and can cook up a patch for this.

Thanks, Eric

#1 lore raw
Quoted 11 lines · Eric Sesterhenn

hi,

coverity spotted another dereference in the reiser code, which i am able to verify, but not sure how to fix:

1305 bh = sb_bread(sb, block);
1306 if (bh == NULL)
1307 reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%lu) "
1308 "reading failed", __FUNCTION__,
bh->b_blocknr);

Thanks Eric

Quoted 3 lines

if bh is NULL, we dereference it in the warning as bh->b_blocknr. Maybe one of you guys knows what warning is useful to print in this case and can cook up a patch for this.

From: Eric Eric Sesterhenn <[email protected]>

null pointer dereferencing in reiserfs_read_bitmap_block.

---
 fs/reiserfs/bitmap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/reiserfs/bitmap.c +2 -2
@@ -1304,8 +1304,8 @@ struct buffer_head *reiserfs_read_bitmap
 
 	bh = sb_bread(sb, block);
 	if (bh == NULL)
-		reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%lu) "
-		                 "reading failed", __FUNCTION__, bh->b_blocknr);
+		reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) "
+		                 "reading failed", __FUNCTION__, block);
 	else {
 		if (buffer_locked(bh)) {
 			PROC_INFO_INC(sb, scan_bitmap.wait);
Signature · 1 line
Alex.