Skip to contentSkip to conversation

libxfs: don't write uninitialized heap contents into new directory blocks

PATCH In review Darrick J. Wong 2 participants 2 messages Mar 19, 2015 – Mar 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libxfs: don't write uninitialized heap contents into new directory blocks

Clear the contents of the xfs buffer when we're initializing it to avoid writing random heap contents (and CRC thereof) to disk.

---
 libxfs/rdwr.c |    1 +
 1 file changed, 1 insertion(+)
libxfs/rdwr.c +1 -0
index 7d73477..35fb366 100644
@@ -411,6 +411,7 @@ __initbuf(xfs_buf_t *bp, struct xfs_buftarg *btp, xfs_daddr_t bno,
 			strerror(errno));
 		exit(1);
 	}
+	memset(bp->b_addr, 0, bytes);
 #ifdef XFS_BUF_TRACING
 	list_head_init(&bp->b_lock_list);
 #endif

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Darrick J. Wong

Clear the contents of the xfs buffer when we're initializing it to avoid writing random heap contents (and CRC thereof) to disk.

---

Looks good to me:

Quoted 16 lines
 libxfs/rdwr.c |    1 +
 1 file changed, 1 insertion(+)
libxfs/rdwr.c +1 -0
index 7d73477..35fb366 100644
@@ -411,6 +411,7 @@ __initbuf(xfs_buf_t *bp, struct xfs_buftarg *btp, xfs_daddr_t bno,
 			strerror(errno));
 		exit(1);
 	}
+	memset(bp->b_addr, 0, bytes);
 #ifdef XFS_BUF_TRACING
 	list_head_init(&bp->b_lock_list);
 #endif
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs