diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-07-21 17:51:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-21 17:51:30 -0400 |
commit | 0da974f4f303a6842516b764507e3c0a03f41e5a (patch) | |
tree | 8872aec792f02040269c6769dd1009b20f71d186 /net/sunrpc/auth_gss | |
parent | a0ee7c70b22f78593957f99faa06acb4747b8bc0 (diff) |
[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 9 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_mech.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_mech_switch.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_spkm3_mech.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_spkm3_token.c | 3 |
5 files changed, 7 insertions, 14 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 519ebc17c028..4a9aa9393b97 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -225,9 +225,8 @@ gss_alloc_context(void) | |||
225 | { | 225 | { |
226 | struct gss_cl_ctx *ctx; | 226 | struct gss_cl_ctx *ctx; |
227 | 227 | ||
228 | ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); | 228 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
229 | if (ctx != NULL) { | 229 | if (ctx != NULL) { |
230 | memset(ctx, 0, sizeof(*ctx)); | ||
231 | ctx->gc_proc = RPC_GSS_PROC_DATA; | 230 | ctx->gc_proc = RPC_GSS_PROC_DATA; |
232 | ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ | 231 | ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ |
233 | spin_lock_init(&ctx->gc_seq_lock); | 232 | spin_lock_init(&ctx->gc_seq_lock); |
@@ -391,9 +390,8 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) | |||
391 | { | 390 | { |
392 | struct gss_upcall_msg *gss_msg; | 391 | struct gss_upcall_msg *gss_msg; |
393 | 392 | ||
394 | gss_msg = kmalloc(sizeof(*gss_msg), GFP_KERNEL); | 393 | gss_msg = kzalloc(sizeof(*gss_msg), GFP_KERNEL); |
395 | if (gss_msg != NULL) { | 394 | if (gss_msg != NULL) { |
396 | memset(gss_msg, 0, sizeof(*gss_msg)); | ||
397 | INIT_LIST_HEAD(&gss_msg->list); | 395 | INIT_LIST_HEAD(&gss_msg->list); |
398 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); | 396 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); |
399 | init_waitqueue_head(&gss_msg->waitqueue); | 397 | init_waitqueue_head(&gss_msg->waitqueue); |
@@ -776,10 +774,9 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
776 | dprintk("RPC: gss_create_cred for uid %d, flavor %d\n", | 774 | dprintk("RPC: gss_create_cred for uid %d, flavor %d\n", |
777 | acred->uid, auth->au_flavor); | 775 | acred->uid, auth->au_flavor); |
778 | 776 | ||
779 | if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL))) | 777 | if (!(cred = kzalloc(sizeof(*cred), GFP_KERNEL))) |
780 | goto out_err; | 778 | goto out_err; |
781 | 779 | ||
782 | memset(cred, 0, sizeof(*cred)); | ||
783 | atomic_set(&cred->gc_count, 1); | 780 | atomic_set(&cred->gc_count, 1); |
784 | cred->gc_uid = acred->uid; | 781 | cred->gc_uid = acred->uid; |
785 | /* | 782 | /* |
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index b8714a87b34c..70e1e53a632b 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
@@ -129,9 +129,8 @@ gss_import_sec_context_kerberos(const void *p, | |||
129 | const void *end = (const void *)((const char *)p + len); | 129 | const void *end = (const void *)((const char *)p + len); |
130 | struct krb5_ctx *ctx; | 130 | struct krb5_ctx *ctx; |
131 | 131 | ||
132 | if (!(ctx = kmalloc(sizeof(*ctx), GFP_KERNEL))) | 132 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_KERNEL))) |
133 | goto out_err; | 133 | goto out_err; |
134 | memset(ctx, 0, sizeof(*ctx)); | ||
135 | 134 | ||
136 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); | 135 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); |
137 | if (IS_ERR(p)) | 136 | if (IS_ERR(p)) |
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index d88468d21c37..3db745379d06 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
@@ -237,9 +237,8 @@ gss_import_sec_context(const void *input_token, size_t bufsize, | |||
237 | struct gss_api_mech *mech, | 237 | struct gss_api_mech *mech, |
238 | struct gss_ctx **ctx_id) | 238 | struct gss_ctx **ctx_id) |
239 | { | 239 | { |
240 | if (!(*ctx_id = kmalloc(sizeof(**ctx_id), GFP_KERNEL))) | 240 | if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL))) |
241 | return GSS_S_FAILURE; | 241 | return GSS_S_FAILURE; |
242 | memset(*ctx_id, 0, sizeof(**ctx_id)); | ||
243 | (*ctx_id)->mech_type = gss_mech_get(mech); | 242 | (*ctx_id)->mech_type = gss_mech_get(mech); |
244 | 243 | ||
245 | return mech->gm_ops | 244 | return mech->gm_ops |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_mech.c b/net/sunrpc/auth_gss/gss_spkm3_mech.c index 3d0432aa45c1..88dcb52d171b 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_mech.c +++ b/net/sunrpc/auth_gss/gss_spkm3_mech.c | |||
@@ -152,9 +152,8 @@ gss_import_sec_context_spkm3(const void *p, size_t len, | |||
152 | const void *end = (const void *)((const char *)p + len); | 152 | const void *end = (const void *)((const char *)p + len); |
153 | struct spkm3_ctx *ctx; | 153 | struct spkm3_ctx *ctx; |
154 | 154 | ||
155 | if (!(ctx = kmalloc(sizeof(*ctx), GFP_KERNEL))) | 155 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_KERNEL))) |
156 | goto out_err; | 156 | goto out_err; |
157 | memset(ctx, 0, sizeof(*ctx)); | ||
158 | 157 | ||
159 | p = simple_get_netobj(p, end, &ctx->ctx_id); | 158 | p = simple_get_netobj(p, end, &ctx->ctx_id); |
160 | if (IS_ERR(p)) | 159 | if (IS_ERR(p)) |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_token.c b/net/sunrpc/auth_gss/gss_spkm3_token.c index af0d7ce74686..854a983ccf26 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_token.c +++ b/net/sunrpc/auth_gss/gss_spkm3_token.c | |||
@@ -90,10 +90,9 @@ asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits) | |||
90 | int | 90 | int |
91 | decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) | 91 | decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) |
92 | { | 92 | { |
93 | if (!(out->data = kmalloc(explen,GFP_KERNEL))) | 93 | if (!(out->data = kzalloc(explen,GFP_KERNEL))) |
94 | return 0; | 94 | return 0; |
95 | out->len = explen; | 95 | out->len = explen; |
96 | memset(out->data, 0, explen); | ||
97 | memcpy(out->data, in, enclen); | 96 | memcpy(out->data, in, enclen); |
98 | return 1; | 97 | return 1; |
99 | } | 98 | } |