public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] logprint: Fix printing of AGF buffers
@ 2014-07-14 14:45 Jan Kara
  2014-07-15 10:19 ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kara @ 2014-07-14 14:45 UTC (permalink / raw)
  To: xfs; +Cc: Jan Kara

Currently xfs_logprint doesn't show detailed data about AGF buffers and
instead always shows "Out of space". This is because xfs_agf_t has
additional fields and padding which we never read from disk and thus
buffer length is always smaller than the size of xfs_agf_t.

Fix the problem by only making sure we have enough data in the buffer
to contain all the information we want to print.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 logprint/log_misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index d482cf3fba57..e7306c08789a 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -367,7 +367,8 @@ xlog_print_trans_buffer(xfs_caddr_t *ptr, int len, int *i, int num_ops)
 	} else if (be32_to_cpu(*(__be32 *)(*ptr)) == XFS_AGF_MAGIC) {
 		agf = (xfs_agf_t *)(*ptr);
 		printf(_("AGF Buffer: XAGF  "));
-		if (be32_to_cpu(head->oh_len) < sizeof(xfs_agf_t)) {
+		/* Make sure buffer contains all the data we want to print */
+		if (be32_to_cpu(head->oh_len) < offsetof(xfs_agf_t, agf_uuid)) {
 			printf(_("Out of space\n"));
 		} else {
 			printf("\n");
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-07-18  0:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14 14:45 [PATCH] logprint: Fix printing of AGF buffers Jan Kara
2014-07-15 10:19 ` Christoph Hellwig
2014-07-15 14:09   ` Jan Kara
2014-07-15 15:39     ` Christoph Hellwig
2014-07-16  0:38       ` Dave Chinner
2014-07-16  8:11         ` Christoph Hellwig
2014-07-16 20:33           ` Jan Kara
2014-07-16 23:17           ` Dave Chinner
2014-07-17  8:39             ` Jan Kara
2014-07-18  0:29               ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox