From patchwork Thu Jun 16 22:51:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 636715 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rVzBj00CNz9t0v for ; Fri, 17 Jun 2016 08:51:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754006AbcFPWvH (ORCPT ); Thu, 16 Jun 2016 18:51:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55647 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753864AbcFPWvF (ORCPT ); Thu, 16 Jun 2016 18:51:05 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CBF5693F2 for ; Thu, 16 Jun 2016 22:51:05 +0000 (UTC) Received: from [IPv6:::1] (ovpn03.gateway.prod.ext.phx2.redhat.com [10.5.9.3]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5GMp4YW007256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Jun 2016 18:51:05 -0400 To: "linux-ext4@vger.kernel.org" From: Eric Sandeen Subject: [PATCH] e2undo: fix endian issues Message-ID: Date: Thu, 16 Jun 2016 17:51:04 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 16 Jun 2016 22:51:05 +0000 (UTC) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Two new e2undo issues exist in the latest release on big endian machines. From sparse check: undo_io.c:157:26: warning: invalid assignment: |= undo_io.c:157:26: left side has type restricted __le32 undo_io.c:157:26: right side has type int undo_io.c:161:26: warning: invalid assignment: &= undo_io.c:161:26: left side has type restricted __le32 undo_io.c:161:26: right side has type int e2undo.c:211:16: warning: cast to restricted __le64 e2undo.c:211:16: warning: cast from restricted blk64_t e2undo.c:212:16: warning: cast to restricted __le64 e2undo.c:212:16: warning: cast from restricted blk64_t Addresses-RedHat-Bugzilla: 1344636 Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/ext2fs/undo_io.c b/lib/ext2fs/undo_io.c index f921218..776d5b8 100644 --- a/lib/ext2fs/undo_io.c +++ b/lib/ext2fs/undo_io.c @@ -154,11 +154,11 @@ struct undo_private_data { #define E2UNDO_FEATURE_COMPAT_FS_OFFSET 0x1 /* the filesystem offset */ static inline void e2undo_set_feature_fs_offset(struct undo_header *header) { - header->f_compat |= E2UNDO_FEATURE_COMPAT_FS_OFFSET; + header->f_compat |= ext2fs_le32_to_cpu(E2UNDO_FEATURE_COMPAT_FS_OFFSET); } static inline void e2undo_clear_feature_fs_offset(struct undo_header *header) { - header->f_compat &= ~E2UNDO_FEATURE_COMPAT_FS_OFFSET; + header->f_compat &= ~ext2fs_le32_to_cpu(E2UNDO_FEATURE_COMPAT_FS_OFFSET); } static io_manager undo_io_backing_manager; diff --git a/misc/e2undo.c b/misc/e2undo.c index a8cb000..6fb6e44 100644 --- a/misc/e2undo.c +++ b/misc/e2undo.c @@ -208,8 +208,7 @@ static int key_compare(const void *a, const void *b) ka = a; kb = b; - return ext2fs_le64_to_cpu(ka->fsblk) - - ext2fs_le64_to_cpu(kb->fsblk); + return ka->fsblk - kb->fsblk; } static int e2undo_setup_tdb(const char *name, io_manager *io_ptr)