All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: "Yan, Zheng" <zyan@redhat.com>
Cc: Sage Weil <sage@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
	ceph-devel@vger.kernel.org
Subject: [PATCH 4/4] ceph: fix bad endianness handling in parse_reply_info_extra
Date: Thu, 12 Jan 2017 11:12:45 -0500	[thread overview]
Message-ID: <1484237565-27423-5-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1484237565-27423-1-git-send-email-jlayton@redhat.com>

sparse says:

    fs/ceph/mds_client.c:291:23: warning: restricted __le32 degrades to integer
    fs/ceph/mds_client.c:293:28: warning: restricted __le32 degrades to integer
    fs/ceph/mds_client.c:294:28: warning: restricted __le32 degrades to integer
    fs/ceph/mds_client.c:296:28: warning: restricted __le32 degrades to integer

The op value is __le32, so we need to convert it before comparing it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/ceph/mds_client.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 4568f80308f8..176512960b14 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -288,12 +288,13 @@ static int parse_reply_info_extra(void **p, void *end,
 				  struct ceph_mds_reply_info_parsed *info,
 				  u64 features)
 {
-	if (info->head->op == CEPH_MDS_OP_GETFILELOCK)
+	u32 op = le32_to_cpu(info->head->op);
+
+	if (op == CEPH_MDS_OP_GETFILELOCK)
 		return parse_reply_info_filelock(p, end, info, features);
-	else if (info->head->op == CEPH_MDS_OP_READDIR ||
-		 info->head->op == CEPH_MDS_OP_LSSNAP)
+	else if (op == CEPH_MDS_OP_READDIR || op == CEPH_MDS_OP_LSSNAP)
 		return parse_reply_info_dir(p, end, info, features);
-	else if (info->head->op == CEPH_MDS_OP_CREATE)
+	else if (op == CEPH_MDS_OP_CREATE)
 		return parse_reply_info_create(p, end, info, features);
 	else
 		return -EIO;
-- 
2.7.4


  parent reply	other threads:[~2017-01-12 16:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 16:12 [PATCH 0/4] ceph: endianness fixes and sparse warning fixes Jeff Layton
2017-01-12 16:12 ` [PATCH 1/4] ceph: fix endianness of getattr mask in ceph_d_revalidate Jeff Layton
2017-01-12 16:43   ` Ilya Dryomov
2017-01-12 17:16     ` Jeff Layton
2017-01-12 16:12 ` [PATCH 2/4] ceph: fix endianness bug in frag_tree_split_cmp Jeff Layton
2017-01-12 16:12 ` [PATCH 3/4] ceph: fix bogus endianness change in ceph_ioctl_set_layout Jeff Layton
2017-01-12 16:12 ` Jeff Layton [this message]
2017-01-12 16:23 ` [PATCH 0/4] ceph: endianness fixes and sparse warning fixes Sage Weil
2017-01-13 12:36   ` Jeff Layton
2017-01-17 18:26     ` David Disseldorp
2017-01-17 18:28       ` Ilya Dryomov

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=1484237565-27423-5-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=sage@redhat.com \
    --cc=zyan@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.