netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Alexander Sverdlin <alexander.sverdlin@nokia.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 3/4] xfrm: Prepare for CRYPTO_MAX_ALG_NAME expansion
Date: Thu, 06 Apr 2017 16:16:10 +0800	[thread overview]
Message-ID: <E1cw2aQ-00085u-SY@gondobar> (raw)
In-Reply-To: 20170406081509.GB30557@gondor.apana.org.au

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>
---

 net/xfrm/xfrm_user.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 9705c27..96557cf 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -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;
 }
 

  parent reply	other threads:[~2017-04-06  8:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e96825bd-4e1d-c6c1-160e-0dc10f7f3981@nokia.com>
     [not found] ` <367298c5-aa5d-3708-72d0-8a44702d0caa@nokia.com>
2017-04-06  8:15   ` [PATCH 0/4] crypto: CRYPTO_MAX_ALG_NAME is too low Herbert Xu
2017-04-06  8:16     ` [PATCH 1/4] crypto: user - Prepare for CRYPTO_MAX_ALG_NAME expansion Herbert Xu
2017-04-06 15:10       ` Alexander Sverdlin
2017-04-06  8:16     ` [PATCH 2/4] crypto: af_alg - Allow arbitrarily long algorithm names Herbert Xu
2017-04-06 12:32       ` Alexander Sverdlin
2017-04-07  5:25         ` Herbert Xu
2017-04-06  8:16     ` Herbert Xu [this message]
2017-04-06 15:10       ` [PATCH 3/4] xfrm: Prepare for CRYPTO_MAX_ALG_NAME expansion Alexander Sverdlin
2017-04-06 21:15       ` Steffen Klassert
2017-04-06  8:16     ` [PATCH 4/4] crypto: api - Extend algorithm name limit to 128 bytes Herbert Xu
2017-04-06 15:11       ` Alexander Sverdlin
2017-04-06 15:10     ` [PATCH 0/4] crypto: CRYPTO_MAX_ALG_NAME is too low Alexander Sverdlin
2017-04-06 20:58     ` David Miller
2017-04-06 21:14       ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1cw2aQ-00085u-SY@gondobar \
    --to=herbert@gondor.apana.org.au \
    --cc=alexander.sverdlin@nokia.com \
    --cc=davem@davemloft.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).