mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
nfsd4: remove pointless strdup_if_nonnull
kstrdup() already checks for NULL. (Brought to our attention by Jason Yann noticing (from sparse output) that it should have been declared static.) Signed-off-by: NeilBrown <[email protected]> Reported-by: Jason Yan <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
This commit is contained in:
parent
16719199a4
commit
2f10fdcb6a
1 changed files with 6 additions and 19 deletions
|
|
@ -1912,28 +1912,15 @@ static void copy_clid(struct nfs4_client *target, struct nfs4_client *source)
|
|||
target->cl_clientid.cl_id = source->cl_clientid.cl_id;
|
||||
}
|
||||
|
||||
int strdup_if_nonnull(char **target, char *source)
|
||||
{
|
||||
if (source) {
|
||||
*target = kstrdup(source, GFP_KERNEL);
|
||||
if (!*target)
|
||||
return -ENOMEM;
|
||||
} else
|
||||
*target = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int copy_cred(struct svc_cred *target, struct svc_cred *source)
|
||||
{
|
||||
int ret;
|
||||
target->cr_principal = kstrdup(source->cr_principal, GFP_KERNEL);
|
||||
target->cr_raw_principal = kstrdup(source->cr_raw_principal,
|
||||
GFP_KERNEL);
|
||||
if ((source->cr_principal && ! target->cr_principal) ||
|
||||
(source->cr_raw_principal && ! target->cr_raw_principal))
|
||||
return -ENOMEM;
|
||||
|
||||
ret = strdup_if_nonnull(&target->cr_principal, source->cr_principal);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = strdup_if_nonnull(&target->cr_raw_principal,
|
||||
source->cr_raw_principal);
|
||||
if (ret)
|
||||
return ret;
|
||||
target->cr_flavor = source->cr_flavor;
|
||||
target->cr_uid = source->cr_uid;
|
||||
target->cr_gid = source->cr_gid;
|
||||
|
|
|
|||
Loading…
Reference in a new issue