ceph: silence sparse endianness warning in encode_caps_cb
diff mbox

Message ID 20171031200924.27875-1-jlayton@kernel.org
State New
Headers show

Commit Message

Jeff Layton Oct. 31, 2017, 8:09 p.m. UTC
From: Jeff Layton <jlayton@redhat.com>

fs/ceph/mds_client.c:2887:34: warning: incorrect type in assignment (different base types)
fs/ceph/mds_client.c:2887:34:    expected restricted __le32 [assigned] [usertype] flock_len
fs/ceph/mds_client.c:2887:34:    got int

At this point, it's just being used as a flag. It gets
overwritten later if the rest of the encoding succeeds.

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

Comments

Yan, Zheng Nov. 1, 2017, 2:16 a.m. UTC | #1
> On 1 Nov 2017, at 04:09, Jeff Layton <jlayton@kernel.org> wrote:
> 
> From: Jeff Layton <jlayton@redhat.com>
> 
> fs/ceph/mds_client.c:2887:34: warning: incorrect type in assignment (different base types)
> fs/ceph/mds_client.c:2887:34:    expected restricted __le32 [assigned] [usertype] flock_len
> fs/ceph/mds_client.c:2887:34:    got int
> 
> At this point, it's just being used as a flag. It gets
> overwritten later if the rest of the encoding succeeds.
> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
> fs/ceph/mds_client.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index f5b1e8d73e85..927afb612e43 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -2884,8 +2884,8 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap,
> 		rec.v2.issued = cpu_to_le32(cap->issued);
> 		rec.v2.snaprealm = cpu_to_le64(ci->i_snap_realm->ino);
> 		rec.v2.pathbase = cpu_to_le64(pathbase);
> -		rec.v2.flock_len =
> -			(ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1;
> +		rec.v2.flock_len = (__force __le32)
> +			((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1);
> 	} else {
> 		rec.v1.cap_id = cpu_to_le64(cap->cap_id);
> 		rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci));

Reviewed-by: "Yan, Zheng" <zyan@redhat.com>

> -- 
> 2.13.6
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index f5b1e8d73e85..927afb612e43 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2884,8 +2884,8 @@  static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap,
 		rec.v2.issued = cpu_to_le32(cap->issued);
 		rec.v2.snaprealm = cpu_to_le64(ci->i_snap_realm->ino);
 		rec.v2.pathbase = cpu_to_le64(pathbase);
-		rec.v2.flock_len =
-			(ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1;
+		rec.v2.flock_len = (__force __le32)
+			((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1);
 	} else {
 		rec.v1.cap_id = cpu_to_le64(cap->cap_id);
 		rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci));