mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
crypto: api - Fix aligned ctx helper
The aligned ctx helper was using a bogus alignment value thas was one off the correct value. Fortunately the current users do not require anything beyond the natural alignment of the platform so this hasn't caused a problem. This patch fixes that and also removes the unnecessary minimum check since if the alignment is less than the natural alignment then the subsequent ALIGN operation should be a noop. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
0b767b4df3
commit
ab30046567
1 changed files with 2 additions and 6 deletions
|
@ -175,12 +175,8 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc,
|
||||||
|
|
||||||
static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
|
static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm);
|
return PTR_ALIGN(crypto_tfm_ctx(tfm),
|
||||||
unsigned long align = crypto_tfm_alg_alignmask(tfm);
|
crypto_tfm_alg_alignmask(tfm) + 1);
|
||||||
|
|
||||||
if (align <= crypto_tfm_ctx_alignment())
|
|
||||||
align = 1;
|
|
||||||
return (void *)ALIGN(addr, align);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct crypto_instance *crypto_tfm_alg_instance(
|
static inline struct crypto_instance *crypto_tfm_alg_instance(
|
||||||
|
|
Loading…
Reference in a new issue