From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Z6xV6-0004uq-EA for mharc-grub-devel@gnu.org; Mon, 22 Jun 2015 04:54:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6xV2-0004sy-WE for grub-devel@gnu.org; Mon, 22 Jun 2015 04:54:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6xUx-0002AO-Sn for grub-devel@gnu.org; Mon, 22 Jun 2015 04:54:40 -0400 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]:35247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6xUx-0002AF-LC for grub-devel@gnu.org; Mon, 22 Jun 2015 04:54:35 -0400 Received: by wgbhy7 with SMTP id hy7so135133392wgb.2 for ; Mon, 22 Jun 2015 01:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id; bh=eDBtt1FXg83X1P13JCh8RMFSmp1lsKkj5wtvTGwATFg=; b=0PVB7EzCMEYuMUVXpVb3C7DihbCpfSZaWqVx/yR7A9iTwFxmrg/I/Vx3anyo1KRqs7 cqnpoD7IrN288R4+DikNfaxI2CuDgnPzDZ4fmJGrI63AAUPGL43DwtIiuPgg54OPSyb9 Ki8f3m75xpkD22IVQALaxJ7q/Vavl5AQ+zwQ7iAB+P0QHV6RJIc3rfjRLB2tFwwI7E6R h5/GYvPCgzi9m16PityPmZCYH7A0ZWmFWYXHlOV/gtpqveKlg0HvGhITKCpael7APm3o NksufzuZPL//kg22cJ63B5hdeYEFSxVBhIFsNT9GSN4WcsFeKOZz0pCtF0veJSMmSRjV GgTg== X-Received: by 10.194.78.175 with SMTP id c15mr49492431wjx.136.1434963274448; Mon, 22 Jun 2015 01:54:34 -0700 (PDT) Received: from localhost.localdomain ([203.192.156.9]) by mx.google.com with ESMTPSA id d3sm29443607wjs.21.2015.06.22.01.54.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jun 2015 01:54:32 -0700 (PDT) Sender: =?UTF-8?B?5by15paH6I+v?= From: Michael Chang To: grub-devel@gnu.org Subject: [PATCH] Fix missing byte order conversion in get_btrfs_fs_prefix function Date: Mon, 22 Jun 2015 16:45:27 +0800 Message-Id: <1434962727-16154-1-git-send-email-mchang@suse.com> X-Mailer: git-send-email 1.7.3.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::235 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2015 08:54:42 -0000 Since btrfs on-disk format uses little-endian, the searched item types (ROOT_REF, INODE_REF) need converting the byte order in order to function properly on big-endian systems. --- grub-core/osdep/linux/getroot.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c index a2e360f..3978c71 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -316,9 +316,9 @@ get_btrfs_fs_prefix (const char *mount_path) tree_id = sargs.buf[2]; br = (struct grub_btrfs_root_backref *) (sargs.buf + 4); - inode_id = br->inode_id; + inode_id = grub_le_to_cpu64 (br->inode_id); name = br->name; - namelen = br->n; + namelen = grub_le_to_cpu16 (br->n); } else { @@ -345,7 +345,7 @@ get_btrfs_fs_prefix (const char *mount_path) ir = (struct grub_btrfs_inode_ref *) (sargs.buf + 4); name = ir->name; - namelen = ir->n; + namelen = grub_le_to_cpu16 (ir->n); } old = ret; ret = xmalloc (namelen + (old ? strlen (old) : 0) + 2); -- 1.7.3.4