]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
xfrm: Prepare for CRYPTO_MAX_ALG_NAME expansion
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 6 Apr 2017 08:16:10 +0000 (16:16 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 10 Apr 2017 11:17:26 +0000 (19:17 +0800)
This patch fixes the xfrm_user code to use the actual array size
rather than the hard-coded CRYPTO_MAX_ALG_NAME length.  This is
because the array size is fixed at 64 bytes while we want to increase
the in-kernel CRYPTO_MAX_ALG_NAME value.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Tested-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_user.c

index 9705c279494b248b759155d671cfbc778fa25058..96557cf6389ed50981460817e67073463c68251c 100644 (file)
@@ -55,7 +55,7 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
                return -EINVAL;
        }
 
-       algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
+       algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';
        return 0;
 }
 
@@ -71,7 +71,7 @@ static int verify_auth_trunc(struct nlattr **attrs)
        if (nla_len(rt) < xfrm_alg_auth_len(algp))
                return -EINVAL;
 
-       algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
+       algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';
        return 0;
 }
 
@@ -87,7 +87,7 @@ static int verify_aead(struct nlattr **attrs)
        if (nla_len(rt) < aead_len(algp))
                return -EINVAL;
 
-       algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
+       algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';
        return 0;
 }