linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfsprogs: xfs_db: Interpret inode's di_format field as unsigned
Date: Tue, 24 Jan 2017 09:05:13 -0800	[thread overview]
Message-ID: <20170124170513.GB9134@birch.djwong.org> (raw)
In-Reply-To: <1485262673-22783-1-git-send-email-chandan@linux.vnet.ibm.com>

On Tue, Jan 24, 2017 at 06:27:53PM +0530, Chandan Rajendra wrote:
> On a ppc64 big endian system, xfs_db would print the following,
> 
> xfs_db> p
> core.magic = 0x494e
> core.mode = 0100600
> core.version = 3
> core.format = -253
> 
> This is due to fp_dinode_fmt() interpretting the di_format field as
> signed. This commit fixes the bug by passing BVUNSIGNED (instead of
> BVSIGNED) as the argument to getbitval(). With this commit applied, we
> now get,
> 
> xfs_db> p
> core.magic = 0x494e
> core.mode = 0100600
> core.version = 3
> core.format = 3 (btree)
> 
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>

I hit this bug running fuzztests on ppc64, so
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  db/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/db/inode.c b/db/inode.c
> index cac19fc..8b7a41e 100644
> --- a/db/inode.c
> +++ b/db/inode.c
> @@ -238,7 +238,7 @@ fp_dinode_fmt(
>  	int			i;
>  
>  	for (i = 0, bitpos = bit; i < count; i++, bitpos += size) {
> -		f = (xfs_dinode_fmt_t)getbitval(obj, bitpos, size, BVSIGNED);
> +		f = (xfs_dinode_fmt_t)getbitval(obj, bitpos, size, BVUNSIGNED);
>  		if (array)
>  			dbprintf("%d:", i + base);
>  		if (f < 0 || f >= dinode_fmt_name_size)
> -- 
> 2.5.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2017-01-24 17:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 12:57 [PATCH] xfsprogs: xfs_db: Interpret inode's di_format field as unsigned Chandan Rajendra
2017-01-24 17:05 ` Darrick J. Wong [this message]

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=20170124170513.GB9134@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=chandan@linux.vnet.ibm.com \
    --cc=linux-xfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).