From patchwork Tue Jan 24 12:57:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 9535153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E038B60434 for ; Tue, 24 Jan 2017 12:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D409820499 for ; Tue, 24 Jan 2017 12:58:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7E8F209CD; Tue, 24 Jan 2017 12:58:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFC6B20499 for ; Tue, 24 Jan 2017 12:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750811AbdAXM6G (ORCPT ); Tue, 24 Jan 2017 07:58:06 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38948 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbdAXM6F (ORCPT ); Tue, 24 Jan 2017 07:58:05 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v0OCsC58084875 for ; Tue, 24 Jan 2017 07:58:05 -0500 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 2865qymjt6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 24 Jan 2017 07:58:04 -0500 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Jan 2017 07:58:03 -0500 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Jan 2017 07:58:01 -0500 Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 58987C90041 for ; Tue, 24 Jan 2017 07:57:43 -0500 (EST) Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v0OCw1bw11731356; Tue, 24 Jan 2017 12:58:01 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 31BCB124047; Tue, 24 Jan 2017 07:58:01 -0500 (EST) Received: from localhost.in.ibm.com (unknown [9.85.84.146]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id 305D5124037; Tue, 24 Jan 2017 07:57:59 -0500 (EST) From: Chandan Rajendra Cc: Chandan Rajendra , linux-xfs@vger.kernel.org Subject: [PATCH] xfsprogs: xfs_db: Interpret inode's di_format field as unsigned Date: Tue, 24 Jan 2017 18:27:53 +0530 X-Mailer: git-send-email 2.5.5 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17012412-0056-0000-0000-0000028DEC15 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006490; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000200; SDB=6.00812004; UDB=6.00395957; IPR=6.00589420; BA=6.00005084; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014025; XFM=3.00000011; UTC=2017-01-24 12:58:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17012412-0057-0000-0000-000006C2F2CF Message-Id: <1485262673-22783-1-git-send-email-chandan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-01-24_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701240095 To: unlisted-recipients:; (no To-header on input) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Darrick J. Wong --- 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)