diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-07-16 06:52:20 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-08-03 17:05:23 -0400 |
commit | 6ac0fbbfc141f758e2f331d1fee95bc105f87914 (patch) | |
tree | 306e6f9ae78182e518a3d1b63e7f25b892ca1512 /net | |
parent | c5e6aecd034e70e73af4d7a2b8a115239e3568b5 (diff) |
sunrpc: clean up sparse endianness warnings in gss_krb5_seal.c
Use u16 pointer in setup_token and setup_token_v2. None of the fields
are actually handled as __be16, so this simplifies the code a bit. Also
get rid of some unneeded pointer increments.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_seal.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c index 62ae3273186c..42768e5c3994 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seal.c +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c | |||
@@ -70,31 +70,37 @@ | |||
70 | 70 | ||
71 | DEFINE_SPINLOCK(krb5_seq_lock); | 71 | DEFINE_SPINLOCK(krb5_seq_lock); |
72 | 72 | ||
73 | static char * | 73 | static void * |
74 | setup_token(struct krb5_ctx *ctx, struct xdr_netobj *token) | 74 | setup_token(struct krb5_ctx *ctx, struct xdr_netobj *token) |
75 | { | 75 | { |
76 | __be16 *ptr, *krb5_hdr; | 76 | u16 *ptr; |
77 | void *krb5_hdr; | ||
77 | int body_size = GSS_KRB5_TOK_HDR_LEN + ctx->gk5e->cksumlength; | 78 | int body_size = GSS_KRB5_TOK_HDR_LEN + ctx->gk5e->cksumlength; |
78 | 79 | ||
79 | token->len = g_token_size(&ctx->mech_used, body_size); | 80 | token->len = g_token_size(&ctx->mech_used, body_size); |
80 | 81 | ||
81 | ptr = (__be16 *)token->data; | 82 | ptr = (u16 *)token->data; |
82 | g_make_token_header(&ctx->mech_used, body_size, (unsigned char **)&ptr); | 83 | g_make_token_header(&ctx->mech_used, body_size, (unsigned char **)&ptr); |
83 | 84 | ||
84 | /* ptr now at start of header described in rfc 1964, section 1.2.1: */ | 85 | /* ptr now at start of header described in rfc 1964, section 1.2.1: */ |
85 | krb5_hdr = ptr; | 86 | krb5_hdr = ptr; |
86 | *ptr++ = KG_TOK_MIC_MSG; | 87 | *ptr++ = KG_TOK_MIC_MSG; |
87 | *ptr++ = cpu_to_le16(ctx->gk5e->signalg); | 88 | /* |
89 | * signalg is stored as if it were converted from LE to host endian, even | ||
90 | * though it's an opaque pair of bytes according to the RFC. | ||
91 | */ | ||
92 | *ptr++ = (__force u16)cpu_to_le16(ctx->gk5e->signalg); | ||
88 | *ptr++ = SEAL_ALG_NONE; | 93 | *ptr++ = SEAL_ALG_NONE; |
89 | *ptr++ = 0xffff; | 94 | *ptr = 0xffff; |
90 | 95 | ||
91 | return (char *)krb5_hdr; | 96 | return krb5_hdr; |
92 | } | 97 | } |
93 | 98 | ||
94 | static void * | 99 | static void * |
95 | setup_token_v2(struct krb5_ctx *ctx, struct xdr_netobj *token) | 100 | setup_token_v2(struct krb5_ctx *ctx, struct xdr_netobj *token) |
96 | { | 101 | { |
97 | __be16 *ptr, *krb5_hdr; | 102 | u16 *ptr; |
103 | void *krb5_hdr; | ||
98 | u8 *p, flags = 0x00; | 104 | u8 *p, flags = 0x00; |
99 | 105 | ||
100 | if ((ctx->flags & KRB5_CTX_FLAG_INITIATOR) == 0) | 106 | if ((ctx->flags & KRB5_CTX_FLAG_INITIATOR) == 0) |
@@ -104,15 +110,15 @@ setup_token_v2(struct krb5_ctx *ctx, struct xdr_netobj *token) | |||
104 | 110 | ||
105 | /* Per rfc 4121, sec 4.2.6.1, there is no header, | 111 | /* Per rfc 4121, sec 4.2.6.1, there is no header, |
106 | * just start the token */ | 112 | * just start the token */ |
107 | krb5_hdr = ptr = (__be16 *)token->data; | 113 | krb5_hdr = ptr = (u16 *)token->data; |
108 | 114 | ||
109 | *ptr++ = KG2_TOK_MIC; | 115 | *ptr++ = KG2_TOK_MIC; |
110 | p = (u8 *)ptr; | 116 | p = (u8 *)ptr; |
111 | *p++ = flags; | 117 | *p++ = flags; |
112 | *p++ = 0xff; | 118 | *p++ = 0xff; |
113 | ptr = (__be16 *)p; | 119 | ptr = (u16 *)p; |
114 | *ptr++ = 0xffff; | ||
115 | *ptr++ = 0xffff; | 120 | *ptr++ = 0xffff; |
121 | *ptr = 0xffff; | ||
116 | 122 | ||
117 | token->len = GSS_KRB5_TOK_HDR_LEN + ctx->gk5e->cksumlength; | 123 | token->len = GSS_KRB5_TOK_HDR_LEN + ctx->gk5e->cksumlength; |
118 | return krb5_hdr; | 124 | return krb5_hdr; |
@@ -181,7 +187,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text, | |||
181 | spin_lock(&krb5_seq_lock); | 187 | spin_lock(&krb5_seq_lock); |
182 | seq_send = ctx->seq_send64++; | 188 | seq_send = ctx->seq_send64++; |
183 | spin_unlock(&krb5_seq_lock); | 189 | spin_unlock(&krb5_seq_lock); |
184 | *((u64 *)(krb5_hdr + 8)) = cpu_to_be64(seq_send); | 190 | *((__be64 *)(krb5_hdr + 8)) = cpu_to_be64(seq_send); |
185 | 191 | ||
186 | if (ctx->initiate) { | 192 | if (ctx->initiate) { |
187 | cksumkey = ctx->initiator_sign; | 193 | cksumkey = ctx->initiator_sign; |