public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: xfs@oss.sgi.com
Cc: Jan Kara <jack@suse.cz>
Subject: [PATCH] logprint: Fix printing of AGF buffers
Date: Mon, 14 Jul 2014 16:45:00 +0200	[thread overview]
Message-ID: <1405349100-19734-1-git-send-email-jack@suse.cz> (raw)

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

             reply	other threads:[~2014-07-14 14:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 14:45 Jan Kara [this message]
2014-07-15 10:19 ` [PATCH] logprint: Fix printing of AGF buffers 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405349100-19734-1-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox