Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

svcrpc: introduce init_svc_cred

Common helper to zero out fields of the svc_cred.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>

+9 -4
+7
include/linux/sunrpc/svcauth.h
··· 25 25 char *cr_principal; /* for gss */ 26 26 }; 27 27 28 + static inline void init_svc_cred(struct svc_cred *cred) 29 + { 30 + cred->cr_group_info = NULL; 31 + cred->cr_principal = NULL; 32 + cred->cr_gss_mech = NULL; 33 + } 34 + 28 35 static inline void free_svc_cred(struct svc_cred *cred) 29 36 { 30 37 if (cred->cr_group_info)
+2 -4
net/sunrpc/auth_gss/svcauth_gss.c
··· 377 377 new->handle.data = tmp->handle.data; 378 378 tmp->handle.data = NULL; 379 379 new->mechctx = NULL; 380 - new->cred.cr_group_info = NULL; 381 - new->cred.cr_principal = NULL; 380 + init_svc_cred(&new->cred); 382 381 } 383 382 384 383 static void ··· 391 392 memset(&new->seqdata, 0, sizeof(new->seqdata)); 392 393 spin_lock_init(&new->seqdata.sd_lock); 393 394 new->cred = tmp->cred; 394 - tmp->cred.cr_group_info = NULL; 395 395 new->cred.cr_principal = tmp->cred.cr_principal; 396 - tmp->cred.cr_principal = NULL; 396 + init_svc_cred(&tmp->cred); 397 397 } 398 398 399 399 static struct cache_head *