linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: xfs_db: Interpret inode's di_format field as unsigned
@ 2017-01-24 12:57 Chandan Rajendra
  2017-01-24 17:05 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Chandan Rajendra @ 2017-01-24 12:57 UTC (permalink / raw)
  Cc: Chandan Rajendra, linux-xfs

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>
---
 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


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

end of thread, other threads:[~2017-01-24 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).