linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Christoph Hellwig <hch@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>, Will Deacon <will@kernel.org>,
	Marc Zyngier <maz@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Subject: [PATCH] crypto: talitos - Remove GFP_DMA and add DMA alignment padding
Date: Fri, 30 Dec 2022 15:31:33 +0800	[thread overview]
Message-ID: <Y66T1UCBTqBE6GQ4@gondor.apana.org.au> (raw)
In-Reply-To: <Y651YoR58cCg3adj@gondor.apana.org.au>

GFP_DMA does not guarantee that the returned memory is aligned
for DMA.  It should be removed where it is superfluous.

However, kmalloc may start returning DMA-unaligned memory in future
so fix this by adding the alignment by hand.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 71db6450b6aa..d62ec68e3183 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1393,7 +1393,7 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev,
 		alloc_len += sizeof(struct talitos_desc);
 	alloc_len += ivsize;
 
-	edesc = kmalloc(alloc_len, GFP_DMA | flags);
+	edesc = kmalloc(ALIGN(alloc_len, dma_get_cache_alignment()), flags);
 	if (!edesc)
 		return ERR_PTR(-ENOMEM);
 	if (ivsize) {
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


  reply	other threads:[~2022-12-30  7:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  9:19 [PATCH 0/10] crypto: Driver conversions for DMA alignment Herbert Xu
2022-12-02  9:20 ` [PATCH 1/10] crypto: cavium - Set DMA alignment explicitly Herbert Xu
2022-12-02  9:20 ` [PATCH 2/10] crypto: ccp " Herbert Xu
2022-12-02  9:20 ` [PATCH 3/10] crypto: ccree " Herbert Xu
2022-12-02  9:20 ` [PATCH 4/10] crypto: chelsio " Herbert Xu
2022-12-02  9:20 ` [PATCH 5/10] crypto: hisilicon/hpre " Herbert Xu
2022-12-02  9:20 ` [PATCH 6/10] crypto: safexcel " Herbert Xu
2022-12-02  9:20 ` [PATCH 7/10] crypto: keembay " Herbert Xu
2022-12-02  9:21 ` [PATCH 8/10] crypto: octeontx " Herbert Xu
2022-12-02  9:21 ` [PATCH 9/10] crypto: octeontx2 " Herbert Xu
2022-12-02  9:21 ` [PATCH 10/10] crypto: qce " Herbert Xu
2022-12-02  9:49 ` [PATCH 0/10] crypto: Driver conversions for DMA alignment liulongfang
2022-12-02  9:53   ` Herbert Xu
2022-12-04  9:32 ` Christoph Hellwig
2022-12-06  4:13   ` Herbert Xu
2022-12-06  6:27     ` Christoph Hellwig
2022-12-06  8:34       ` Herbert Xu
2022-12-29  8:58         ` [PATCH] crypto: sun8i-ss - Remove GFP_DMA and add DMA alignment padding Herbert Xu
2022-12-30  5:21           ` [PATCH] crypto: caam " Herbert Xu
2022-12-30  7:31             ` Herbert Xu [this message]
2023-01-08 17:37               ` [PATCH] crypto: talitos " Christoph Hellwig
2023-01-09  7:18               ` Christophe Leroy
2023-01-09  7:37                 ` Herbert Xu
2023-01-08 17:36             ` [PATCH] crypto: caam " Christoph Hellwig
2023-01-03  6:51           ` [PATCH] crypto: sun8i-ss " Corentin Labbe
2023-01-03  7:26             ` Herbert Xu
2023-01-08 17:36           ` Christoph Hellwig

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=Y66T1UCBTqBE6GQ4@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maz@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@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